@zuplo/cli 6.69.4 → 6.69.6

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 (428) hide show
  1. package/dist/__tests__/integration/custom-domain.integration.test.js +4 -4
  2. package/dist/__tests__/integration/custom-domain.integration.test.js.map +1 -1
  3. package/dist/__tests__/integration/jest-mocks-setup.js +30 -10
  4. package/dist/__tests__/integration/jest-mocks-setup.js.map +1 -1
  5. package/dist/__tests__/integration/list.integration.test.js +2 -2
  6. package/dist/__tests__/integration/list.integration.test.js.map +1 -1
  7. package/dist/__tests__/integration/tunnel.integration.test.js +14 -14
  8. package/dist/__tests__/integration/tunnel.integration.test.js.map +1 -1
  9. package/dist/__tests__/integration/variable.integration.test.js +4 -4
  10. package/dist/__tests__/integration/variable.integration.test.js.map +1 -1
  11. package/dist/__tests__/integration/whoami.integration.test.js +2 -5
  12. package/dist/__tests__/integration/whoami.integration.test.js.map +1 -1
  13. package/dist/cli.js +12 -6
  14. package/dist/cli.js.map +1 -1
  15. package/dist/cmds/custom-domain/index.d.ts.map +1 -1
  16. package/dist/cmds/custom-domain/index.js +6 -10
  17. package/dist/cmds/custom-domain/index.js.map +1 -1
  18. package/dist/cmds/mtls-certificates/index.d.ts.map +1 -1
  19. package/dist/cmds/mtls-certificates/index.js +8 -12
  20. package/dist/cmds/mtls-certificates/index.js.map +1 -1
  21. package/dist/cmds/open-api/index.d.ts.map +1 -1
  22. package/dist/cmds/open-api/index.js +2 -5
  23. package/dist/cmds/open-api/index.js.map +1 -1
  24. package/dist/cmds/project/index.d.ts.map +1 -1
  25. package/dist/cmds/project/index.js +2 -5
  26. package/dist/cmds/project/index.js.map +1 -1
  27. package/dist/cmds/proxies/index.d.ts +4 -4
  28. package/dist/cmds/proxies/index.d.ts.map +1 -1
  29. package/dist/cmds/proxies/index.js +6 -10
  30. package/dist/cmds/proxies/index.js.map +1 -1
  31. package/dist/cmds/source/index.d.ts.map +1 -1
  32. package/dist/cmds/source/index.js +2 -9
  33. package/dist/cmds/source/index.js.map +1 -1
  34. package/dist/cmds/source/migrate.d.ts +4 -4
  35. package/dist/cmds/source/migrate.d.ts.map +1 -1
  36. package/dist/cmds/source/migrate.js +3 -6
  37. package/dist/cmds/source/migrate.js.map +1 -1
  38. package/dist/cmds/tunnel/index.d.ts.map +1 -1
  39. package/dist/cmds/tunnel/index.js +8 -12
  40. package/dist/cmds/tunnel/index.js.map +1 -1
  41. package/dist/cmds/tunnel/services/index.d.ts.map +1 -1
  42. package/dist/cmds/tunnel/services/index.js +2 -5
  43. package/dist/cmds/tunnel/services/index.js.map +1 -1
  44. package/dist/cmds/variable/index.d.ts.map +1 -1
  45. package/dist/cmds/variable/index.js +2 -5
  46. package/dist/cmds/variable/index.js.map +1 -1
  47. package/dist/common/api/client.d.ts +40 -0
  48. package/dist/common/api/client.d.ts.map +1 -0
  49. package/dist/common/api/client.js +92 -0
  50. package/dist/common/api/client.js.map +1 -0
  51. package/dist/common/handler.d.ts +4 -1
  52. package/dist/common/handler.d.ts.map +1 -1
  53. package/dist/common/handler.js +11 -2
  54. package/dist/common/handler.js.map +1 -1
  55. package/dist/common/middleware/get-environment-param.d.ts.map +1 -1
  56. package/dist/common/middleware/get-environment-param.js +2 -18
  57. package/dist/common/middleware/get-environment-param.js.map +1 -1
  58. package/dist/common/output.d.ts +4 -0
  59. package/dist/common/output.d.ts.map +1 -1
  60. package/dist/common/output.js +4 -1
  61. package/dist/common/output.js.map +1 -1
  62. package/dist/common/utils/build-environment-prompt-choices.d.ts +13 -0
  63. package/dist/common/utils/build-environment-prompt-choices.d.ts.map +1 -0
  64. package/dist/common/utils/build-environment-prompt-choices.js +66 -0
  65. package/dist/common/utils/build-environment-prompt-choices.js.map +1 -0
  66. package/dist/common/utils/build-environment-prompt-choices.test.d.ts +2 -0
  67. package/dist/common/utils/build-environment-prompt-choices.test.d.ts.map +1 -0
  68. package/dist/common/utils/build-environment-prompt-choices.test.js +97 -0
  69. package/dist/common/utils/build-environment-prompt-choices.test.js.map +1 -0
  70. package/dist/common/utils/pretty-print-environment-prompt.d.ts +1 -4
  71. package/dist/common/utils/pretty-print-environment-prompt.d.ts.map +1 -1
  72. package/dist/common/utils/pretty-print-environment-prompt.js +3 -8
  73. package/dist/common/utils/pretty-print-environment-prompt.js.map +1 -1
  74. package/dist/common/utils/pretty-print-environment-prompt.test.js +15 -17
  75. package/dist/common/utils/pretty-print-environment-prompt.test.js.map +1 -1
  76. package/dist/common/utils/sort-environments-for-prompt.d.ts +5 -0
  77. package/dist/common/utils/sort-environments-for-prompt.d.ts.map +1 -0
  78. package/dist/common/utils/sort-environments-for-prompt.js +27 -0
  79. package/dist/common/utils/sort-environments-for-prompt.js.map +1 -0
  80. package/dist/common/utils/sort-environments-for-prompt.test.d.ts +2 -0
  81. package/dist/common/utils/sort-environments-for-prompt.test.d.ts.map +1 -0
  82. package/dist/common/utils/sort-environments-for-prompt.test.js +82 -0
  83. package/dist/common/utils/sort-environments-for-prompt.test.js.map +1 -0
  84. package/dist/custom-domain/create/handler.d.ts.map +1 -1
  85. package/dist/custom-domain/create/handler.js +12 -27
  86. package/dist/custom-domain/create/handler.js.map +1 -1
  87. package/dist/custom-domain/delete/handler.d.ts.map +1 -1
  88. package/dist/custom-domain/delete/handler.js +25 -54
  89. package/dist/custom-domain/delete/handler.js.map +1 -1
  90. package/dist/custom-domain/list/handler.d.ts.map +1 -1
  91. package/dist/custom-domain/list/handler.js +15 -29
  92. package/dist/custom-domain/list/handler.js.map +1 -1
  93. package/dist/custom-domain/update/handler.d.ts.map +1 -1
  94. package/dist/custom-domain/update/handler.js +12 -27
  95. package/dist/custom-domain/update/handler.js.map +1 -1
  96. package/dist/list/handler.d.ts.map +1 -1
  97. package/dist/list/handler.js +41 -59
  98. package/dist/list/handler.js.map +1 -1
  99. package/dist/mtls-certificates/create/handler.d.ts.map +1 -1
  100. package/dist/mtls-certificates/create/handler.js +9 -23
  101. package/dist/mtls-certificates/create/handler.js.map +1 -1
  102. package/dist/mtls-certificates/delete/handler.d.ts.map +1 -1
  103. package/dist/mtls-certificates/delete/handler.js +8 -20
  104. package/dist/mtls-certificates/delete/handler.js.map +1 -1
  105. package/dist/mtls-certificates/describe/handler.d.ts.map +1 -1
  106. package/dist/mtls-certificates/describe/handler.js +17 -31
  107. package/dist/mtls-certificates/describe/handler.js.map +1 -1
  108. package/dist/mtls-certificates/disable/handler.d.ts.map +1 -1
  109. package/dist/mtls-certificates/disable/handler.js +9 -26
  110. package/dist/mtls-certificates/disable/handler.js.map +1 -1
  111. package/dist/mtls-certificates/list/handler.d.ts.map +1 -1
  112. package/dist/mtls-certificates/list/handler.js +22 -36
  113. package/dist/mtls-certificates/list/handler.js.map +1 -1
  114. package/dist/mtls-certificates/update/handler.d.ts.map +1 -1
  115. package/dist/mtls-certificates/update/handler.js +14 -29
  116. package/dist/mtls-certificates/update/handler.js.map +1 -1
  117. package/dist/proxies/create/handler.d.ts.map +1 -1
  118. package/dist/proxies/create/handler.js +9 -22
  119. package/dist/proxies/create/handler.js.map +1 -1
  120. package/dist/proxies/delete/handler.d.ts.map +1 -1
  121. package/dist/proxies/delete/handler.js +8 -21
  122. package/dist/proxies/delete/handler.js.map +1 -1
  123. package/dist/proxies/describe/handler.d.ts.map +1 -1
  124. package/dist/proxies/describe/handler.js +7 -22
  125. package/dist/proxies/describe/handler.js.map +1 -1
  126. package/dist/proxies/update/handler.d.ts.map +1 -1
  127. package/dist/proxies/update/handler.js +9 -22
  128. package/dist/proxies/update/handler.js.map +1 -1
  129. package/dist/tsconfig.tsbuildinfo +1 -1
  130. package/dist/tunnel/create/handler.d.ts.map +1 -1
  131. package/dist/tunnel/create/handler.js +8 -22
  132. package/dist/tunnel/create/handler.js.map +1 -1
  133. package/dist/tunnel/delete/handler.d.ts.map +1 -1
  134. package/dist/tunnel/delete/handler.js +16 -30
  135. package/dist/tunnel/delete/handler.js.map +1 -1
  136. package/dist/tunnel/describe/handler.d.ts.map +1 -1
  137. package/dist/tunnel/describe/handler.js +7 -21
  138. package/dist/tunnel/describe/handler.js.map +1 -1
  139. package/dist/tunnel/list/handler.d.ts.map +1 -1
  140. package/dist/tunnel/list/handler.js +13 -28
  141. package/dist/tunnel/list/handler.js.map +1 -1
  142. package/dist/tunnel/rotate-token/handler.d.ts.map +1 -1
  143. package/dist/tunnel/rotate-token/handler.js +7 -21
  144. package/dist/tunnel/rotate-token/handler.js.map +1 -1
  145. package/dist/tunnel/services/describe/handler.d.ts.map +1 -1
  146. package/dist/tunnel/services/describe/handler.js +7 -21
  147. package/dist/tunnel/services/describe/handler.js.map +1 -1
  148. package/dist/tunnel/services/update/handler.d.ts.map +1 -1
  149. package/dist/tunnel/services/update/handler.js +18 -32
  150. package/dist/tunnel/services/update/handler.js.map +1 -1
  151. package/dist/variable/create/handler.d.ts.map +1 -1
  152. package/dist/variable/create/handler.js +9 -24
  153. package/dist/variable/create/handler.js.map +1 -1
  154. package/dist/variable/update/handler.d.ts.map +1 -1
  155. package/dist/variable/update/handler.js +9 -24
  156. package/dist/variable/update/handler.js.map +1 -1
  157. package/dist/whoami/handler.d.ts.map +1 -1
  158. package/dist/whoami/handler.js +6 -18
  159. package/dist/whoami/handler.js.map +1 -1
  160. package/node_modules/@fastify/proxy-addr/node_modules/ipaddr.js/README.md +1 -5
  161. package/node_modules/@fastify/proxy-addr/node_modules/ipaddr.js/ipaddr.min.js +1 -1
  162. package/node_modules/@fastify/proxy-addr/node_modules/ipaddr.js/lib/ipaddr.js +21 -6
  163. package/node_modules/@fastify/proxy-addr/node_modules/ipaddr.js/package.json +1 -1
  164. package/node_modules/@zuplo/core/index.minified.js +141 -137
  165. package/node_modules/@zuplo/core/package.json +1 -1
  166. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/.github/workflows/ci.yml +1 -1
  167. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/.github/workflows/lock-threads.yml +19 -0
  168. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/LICENSE +1 -3
  169. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js +60 -44
  170. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/index.js +2 -2
  171. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/package.json +7 -7
  172. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/anyof.test.js +20 -0
  173. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/array.test.js +22 -0
  174. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/debug-mode.test.js +21 -0
  175. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/if-then-else.test.js +72 -0
  176. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/invalidSchema.test.js +20 -0
  177. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/issue-836.test.js +183 -0
  178. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/json-add-comma.test.js +57 -57
  179. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/oneof.test.js +20 -0
  180. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/ref.test.js +31 -0
  181. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/test/typebox.test.js +1 -1
  182. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/types/{index.test-d.ts → index.tst.ts} +17 -17
  183. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map +1 -0
  184. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.js.map +1 -0
  185. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.d.ts +5 -0
  186. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
  187. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +1380 -0
  188. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -0
  189. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/index.js +1686 -0
  190. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -0
  191. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
  192. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +7 -0
  193. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts +12 -0
  194. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts.map +1 -0
  195. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/perf.js +11 -0
  196. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/browser/perf.js.map +1 -0
  197. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.cjs.map +1 -0
  198. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
  199. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +2 -2
  200. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +4 -7
  201. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/index.d.ts +2 -3
  202. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
  203. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/index.js +10 -16
  204. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
  205. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
  206. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/index.min.js.map +4 -4
  207. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.d.ts.map +1 -0
  208. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.js.map +1 -0
  209. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.d.ts +5 -0
  210. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
  211. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/index.d.ts +1380 -0
  212. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -0
  213. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/index.js +1686 -0
  214. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -0
  215. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
  216. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +7 -0
  217. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/perf.d.ts +12 -0
  218. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/perf.d.ts.map +1 -0
  219. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/perf.js +11 -0
  220. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/node/perf.js.map +1 -0
  221. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/perf.d.ts +12 -0
  222. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/perf.d.ts.map +1 -0
  223. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/perf.js +11 -0
  224. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/perf.js.map +1 -0
  225. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.ts.map +1 -0
  226. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.js.map +1 -0
  227. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +1 -1
  228. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +1 -1
  229. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/index.d.ts +2 -3
  230. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
  231. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/index.js +9 -15
  232. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
  233. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
  234. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/index.min.js.map +4 -4
  235. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/perf.d.ts +12 -0
  236. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/perf.d.ts.map +1 -0
  237. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/perf.js +8 -0
  238. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/perf.js.map +1 -0
  239. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -1
  240. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map +1 -1
  241. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/index.d.ts +2 -3
  242. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
  243. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/index.js +9 -15
  244. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/index.js.map +1 -1
  245. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/index.min.js +1 -1
  246. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/index.min.js.map +4 -4
  247. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.ts.map +1 -0
  248. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.js.map +1 -0
  249. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +1 -1
  250. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +2 -3
  251. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/index.d.ts +2 -3
  252. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
  253. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/index.js +9 -15
  254. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
  255. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
  256. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/index.min.js.map +4 -4
  257. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/perf.d.ts +12 -0
  258. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/perf.d.ts.map +1 -0
  259. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/perf.js +8 -0
  260. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/perf.js.map +1 -0
  261. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/perf.d.ts +12 -0
  262. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/perf.d.ts.map +1 -0
  263. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/perf.js +8 -0
  264. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/perf.js.map +1 -0
  265. package/node_modules/@zuplo/editor/node_modules/lru-cache/package.json +44 -16
  266. package/node_modules/@zuplo/graphql/package.json +1 -1
  267. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  268. package/node_modules/@zuplo/otel/package.json +1 -1
  269. package/node_modules/@zuplo/runtime/out/esm/index.js +54 -54
  270. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  271. package/node_modules/@zuplo/runtime/out/types/index.d.ts +4 -0
  272. package/node_modules/@zuplo/runtime/package.json +1 -1
  273. package/node_modules/axios/CHANGELOG.md +32 -6
  274. package/node_modules/axios/README.md +356 -20
  275. package/node_modules/axios/dist/axios.js +1389 -1071
  276. package/node_modules/axios/dist/axios.js.map +1 -1
  277. package/node_modules/axios/dist/axios.min.js +3 -3
  278. package/node_modules/axios/dist/axios.min.js.map +1 -1
  279. package/node_modules/axios/dist/browser/axios.cjs +1486 -1123
  280. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  281. package/node_modules/axios/dist/esm/axios.js +1488 -1124
  282. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  283. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  284. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  285. package/node_modules/axios/dist/node/axios.cjs +1230 -871
  286. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  287. package/node_modules/axios/index.d.cts +25 -13
  288. package/node_modules/axios/index.d.ts +21 -4
  289. package/node_modules/axios/index.js +2 -0
  290. package/node_modules/axios/lib/adapters/adapters.js +4 -2
  291. package/node_modules/axios/lib/adapters/fetch.js +126 -10
  292. package/node_modules/axios/lib/adapters/http.js +178 -59
  293. package/node_modules/axios/lib/adapters/xhr.js +6 -2
  294. package/node_modules/axios/lib/core/Axios.js +7 -3
  295. package/node_modules/axios/lib/core/AxiosError.js +86 -1
  296. package/node_modules/axios/lib/core/AxiosHeaders.js +3 -0
  297. package/node_modules/axios/lib/core/dispatchRequest.js +19 -7
  298. package/node_modules/axios/lib/core/mergeConfig.js +6 -3
  299. package/node_modules/axios/lib/core/settle.js +7 -11
  300. package/node_modules/axios/lib/defaults/index.js +1 -1
  301. package/node_modules/axios/lib/env/data.js +1 -1
  302. package/node_modules/axios/lib/helpers/buildURL.js +1 -1
  303. package/node_modules/axios/lib/helpers/cookies.js +14 -2
  304. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +28 -1
  305. package/node_modules/axios/lib/helpers/formDataToStream.js +1 -1
  306. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  307. package/node_modules/axios/lib/helpers/resolveConfig.js +33 -17
  308. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +26 -1
  309. package/node_modules/axios/lib/helpers/validator.js +1 -1
  310. package/node_modules/axios/lib/utils.js +27 -15
  311. package/node_modules/axios/package.json +17 -24
  312. package/node_modules/fast-uri/.github/workflows/ci.yml +12 -7
  313. package/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
  314. package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +1 -1
  315. package/node_modules/fast-uri/LICENSE +1 -3
  316. package/node_modules/fast-uri/README.md +13 -4
  317. package/node_modules/fast-uri/index.js +90 -24
  318. package/node_modules/fast-uri/lib/utils.js +129 -22
  319. package/node_modules/fast-uri/package.json +3 -4
  320. package/node_modules/fast-uri/test/equal.test.js +9 -0
  321. package/node_modules/fast-uri/test/parse.test.js +5 -0
  322. package/node_modules/fast-uri/test/resolve.test.js +9 -0
  323. package/node_modules/fast-uri/test/security-normalization.test.js +39 -0
  324. package/node_modules/fast-uri/test/security.test.js +133 -0
  325. package/node_modules/is-core-module/CHANGELOG.md +244 -113
  326. package/node_modules/is-core-module/README.md +1 -1
  327. package/node_modules/is-core-module/core.json +12 -12
  328. package/node_modules/is-core-module/package.json +5 -5
  329. package/node_modules/is-core-module/test/index.js +101 -0
  330. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map +1 -0
  331. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.js.map +1 -0
  332. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.d.ts +5 -0
  333. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
  334. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +1380 -0
  335. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -0
  336. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/index.js +1686 -0
  337. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -0
  338. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
  339. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +7 -0
  340. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts +12 -0
  341. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts.map +1 -0
  342. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/perf.js +11 -0
  343. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/browser/perf.js.map +1 -0
  344. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.cjs.map +1 -0
  345. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
  346. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +2 -2
  347. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +4 -7
  348. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/index.d.ts +2 -3
  349. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -1
  350. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/index.js +10 -16
  351. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/index.js.map +1 -1
  352. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
  353. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/index.min.js.map +4 -4
  354. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.d.ts.map +1 -0
  355. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.js.map +1 -0
  356. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.d.ts +5 -0
  357. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
  358. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/index.d.ts +1380 -0
  359. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -0
  360. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/index.js +1686 -0
  361. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -0
  362. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
  363. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +7 -0
  364. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/perf.d.ts +12 -0
  365. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/perf.d.ts.map +1 -0
  366. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/perf.js +11 -0
  367. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/node/perf.js.map +1 -0
  368. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/perf.d.ts +12 -0
  369. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/perf.d.ts.map +1 -0
  370. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/perf.js +11 -0
  371. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/perf.js.map +1 -0
  372. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.ts.map +1 -0
  373. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.js.map +1 -0
  374. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +1 -1
  375. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +1 -1
  376. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/index.d.ts +2 -3
  377. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -1
  378. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/index.js +9 -15
  379. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -1
  380. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/index.min.js +1 -1
  381. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/index.min.js.map +4 -4
  382. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/perf.d.ts +12 -0
  383. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/perf.d.ts.map +1 -0
  384. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/perf.js +8 -0
  385. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/perf.js.map +1 -0
  386. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -1
  387. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map +1 -1
  388. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/index.d.ts +2 -3
  389. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -1
  390. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/index.js +9 -15
  391. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/index.js.map +1 -1
  392. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/index.min.js +1 -1
  393. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/index.min.js.map +4 -4
  394. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.ts.map +1 -0
  395. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.js.map +1 -0
  396. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +1 -1
  397. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +2 -3
  398. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/index.d.ts +2 -3
  399. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -1
  400. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/index.js +9 -15
  401. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/index.js.map +1 -1
  402. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/index.min.js +1 -1
  403. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/index.min.js.map +4 -4
  404. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/perf.d.ts +12 -0
  405. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/perf.d.ts.map +1 -0
  406. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/perf.js +8 -0
  407. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/perf.js.map +1 -0
  408. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/perf.d.ts +12 -0
  409. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/perf.d.ts.map +1 -0
  410. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/perf.js +8 -0
  411. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/perf.js.map +1 -0
  412. package/node_modules/rimraf/node_modules/lru-cache/package.json +44 -16
  413. package/package.json +6 -6
  414. package/node_modules/@zuplo/editor/node_modules/fast-json-stringify/.github/stale.yml +0 -21
  415. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts.map +0 -1
  416. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js.map +0 -1
  417. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.mts.map +0 -1
  418. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.mjs.map +0 -1
  419. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.mts.map +0 -1
  420. package/node_modules/@zuplo/editor/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.mjs.map +0 -1
  421. package/node_modules/fast-uri/.github/.stale.yml +0 -21
  422. package/node_modules/fast-uri/.github/tests_checker.yml +0 -8
  423. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts.map +0 -1
  424. package/node_modules/rimraf/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js.map +0 -1
  425. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.mts.map +0 -1
  426. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.mjs.map +0 -1
  427. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.mts.map +0 -1
  428. package/node_modules/rimraf/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! Axios v1.15.2 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
  var FormData$1 = require('form-data');
@@ -208,9 +208,9 @@ const isFile = kindOfTest('File');
208
208
  * also have a `name` and `type` attribute to specify filename and content type
209
209
  *
210
210
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
211
- *
211
+ *
212
212
  * @param {*} value The value to test
213
- *
213
+ *
214
214
  * @returns {boolean} True if value is a React Native Blob, otherwise false
215
215
  */
216
216
  const isReactNativeBlob = value => {
@@ -220,9 +220,9 @@ const isReactNativeBlob = value => {
220
220
  /**
221
221
  * Determine if environment is React Native
222
222
  * ReactNative `FormData` has a non-standard `getParts()` method
223
- *
223
+ *
224
224
  * @param {*} formData The formData to test
225
- *
225
+ *
226
226
  * @returns {boolean} True if environment is React Native, otherwise false
227
227
  */
228
228
  const isReactNative = formData => formData && typeof formData.getParts !== 'undefined';
@@ -241,7 +241,7 @@ const isBlob = kindOfTest('Blob');
241
241
  *
242
242
  * @param {*} val The value to test
243
243
  *
244
- * @returns {boolean} True if value is a File, otherwise false
244
+ * @returns {boolean} True if value is a FileList, otherwise false
245
245
  */
246
246
  const isFileList = kindOfTest('FileList');
247
247
 
@@ -273,7 +273,7 @@ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
273
273
  const isFormData = thing => {
274
274
  if (!thing) return false;
275
275
  if (FormDataCtor && thing instanceof FormDataCtor) return true;
276
- // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
276
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
277
277
  const proto = getPrototypeOf(thing);
278
278
  if (!proto || proto === Object.prototype) return false;
279
279
  if (!isFunction$1(thing.append)) return false;
@@ -405,8 +405,7 @@ const isContextDefined = context => !isUndefined(context) && context !== _global
405
405
  *
406
406
  * @returns {Object} Result of all merge properties
407
407
  */
408
- function merge(/* obj1, obj2, obj3, ... */
409
- ) {
408
+ function merge(...objs) {
410
409
  const {
411
410
  caseless,
412
411
  skipUndefined
@@ -418,8 +417,12 @@ function merge(/* obj1, obj2, obj3, ... */
418
417
  return;
419
418
  }
420
419
  const targetKey = caseless && findKey(result, key) || key;
421
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
422
- result[targetKey] = merge(result[targetKey], val);
420
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
421
+ // chain, so a polluted Object.prototype value could surface here and get
422
+ // copied into the merged result.
423
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
424
+ if (isPlainObject(existing) && isPlainObject(val)) {
425
+ result[targetKey] = merge(existing, val);
423
426
  } else if (isPlainObject(val)) {
424
427
  result[targetKey] = merge({}, val);
425
428
  } else if (isArray(val)) {
@@ -428,8 +431,8 @@ function merge(/* obj1, obj2, obj3, ... */
428
431
  result[targetKey] = val;
429
432
  }
430
433
  };
431
- for (let i = 0, l = arguments.length; i < l; i++) {
432
- arguments[i] && forEach(arguments[i], assignValue);
434
+ for (let i = 0, l = objs.length; i < l; i++) {
435
+ objs[i] && forEach(objs[i], assignValue);
433
436
  }
434
437
  return result;
435
438
  }
@@ -451,6 +454,9 @@ const extend = (a, b, thisArg, {
451
454
  forEach(b, (val, key) => {
452
455
  if (thisArg && isFunction$1(val)) {
453
456
  Object.defineProperty(a, key, {
457
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
458
+ // hijack defineProperty's accessor-vs-data resolution.
459
+ __proto__: null,
454
460
  value: bind(val, thisArg),
455
461
  writable: true,
456
462
  enumerable: true,
@@ -458,6 +464,7 @@ const extend = (a, b, thisArg, {
458
464
  });
459
465
  } else {
460
466
  Object.defineProperty(a, key, {
467
+ __proto__: null,
461
468
  value: val,
462
469
  writable: true,
463
470
  enumerable: true,
@@ -496,12 +503,14 @@ const stripBOM = content => {
496
503
  const inherits = (constructor, superConstructor, props, descriptors) => {
497
504
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
498
505
  Object.defineProperty(constructor.prototype, 'constructor', {
506
+ __proto__: null,
499
507
  value: constructor,
500
508
  writable: true,
501
509
  enumerable: false,
502
510
  configurable: true
503
511
  });
504
512
  Object.defineProperty(constructor, 'super', {
513
+ __proto__: null,
505
514
  value: superConstructor.prototype
506
515
  });
507
516
  props && Object.assign(constructor.prototype, props);
@@ -669,7 +678,7 @@ const reduceDescriptors = (obj, reducer) => {
669
678
  const freezeMethods = obj => {
670
679
  reduceDescriptors(obj, (descriptor, name) => {
671
680
  // skip restricted props in strict mode
672
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
681
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
673
682
  return false;
674
683
  }
675
684
  const value = obj[name];
@@ -876,407 +885,776 @@ var utils$1 = {
876
885
  isIterable
877
886
  };
878
887
 
879
- class AxiosError extends Error {
880
- static from(error, code, config, request, response, customProps) {
881
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
882
- axiosError.cause = error;
883
- axiosError.name = error.name;
888
+ // RawAxiosHeaders whose duplicates are ignored by node
889
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
890
+ const ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
884
891
 
885
- // Preserve status from the original error if not already set from response
886
- if (error.status != null && axiosError.status == null) {
887
- axiosError.status = error.status;
892
+ /**
893
+ * Parse headers into an object
894
+ *
895
+ * ```
896
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
897
+ * Content-Type: application/json
898
+ * Connection: keep-alive
899
+ * Transfer-Encoding: chunked
900
+ * ```
901
+ *
902
+ * @param {String} rawHeaders Headers needing to be parsed
903
+ *
904
+ * @returns {Object} Headers parsed into an object
905
+ */
906
+ var parseHeaders = rawHeaders => {
907
+ const parsed = {};
908
+ let key;
909
+ let val;
910
+ let i;
911
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
912
+ i = line.indexOf(':');
913
+ key = line.substring(0, i).trim().toLowerCase();
914
+ val = line.substring(i + 1).trim();
915
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
916
+ return;
888
917
  }
889
- customProps && Object.assign(axiosError, customProps);
890
- return axiosError;
891
- }
892
-
893
- /**
894
- * Create an Error with the specified message, config, error code, request and response.
895
- *
896
- * @param {string} message The error message.
897
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
898
- * @param {Object} [config] The config.
899
- * @param {Object} [request] The request.
900
- * @param {Object} [response] The response.
901
- *
902
- * @returns {Error} The created error.
903
- */
904
- constructor(message, code, config, request, response) {
905
- super(message);
918
+ if (key === 'set-cookie') {
919
+ if (parsed[key]) {
920
+ parsed[key].push(val);
921
+ } else {
922
+ parsed[key] = [val];
923
+ }
924
+ } else {
925
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
926
+ }
927
+ });
928
+ return parsed;
929
+ };
906
930
 
907
- // Make message enumerable to maintain backward compatibility
908
- // The native Error constructor sets message as non-enumerable,
909
- // but axios < v1.13.3 had it as enumerable
910
- Object.defineProperty(this, 'message', {
911
- value: message,
912
- enumerable: true,
913
- writable: true,
914
- configurable: true
915
- });
916
- this.name = 'AxiosError';
917
- this.isAxiosError = true;
918
- code && (this.code = code);
919
- config && (this.config = config);
920
- request && (this.request = request);
921
- if (response) {
922
- this.response = response;
923
- this.status = response.status;
931
+ const $internals = Symbol('internals');
932
+ const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
933
+ function trimSPorHTAB(str) {
934
+ let start = 0;
935
+ let end = str.length;
936
+ while (start < end) {
937
+ const code = str.charCodeAt(start);
938
+ if (code !== 0x09 && code !== 0x20) {
939
+ break;
924
940
  }
941
+ start += 1;
925
942
  }
926
- toJSON() {
927
- return {
928
- // Standard
929
- message: this.message,
930
- name: this.name,
931
- // Microsoft
932
- description: this.description,
933
- number: this.number,
934
- // Mozilla
935
- fileName: this.fileName,
936
- lineNumber: this.lineNumber,
937
- columnNumber: this.columnNumber,
938
- stack: this.stack,
939
- // Axios
940
- config: utils$1.toJSONObject(this.config),
941
- code: this.code,
942
- status: this.status
943
- };
943
+ while (end > start) {
944
+ const code = str.charCodeAt(end - 1);
945
+ if (code !== 0x09 && code !== 0x20) {
946
+ break;
947
+ }
948
+ end -= 1;
944
949
  }
950
+ return start === 0 && end === str.length ? str : str.slice(start, end);
945
951
  }
946
-
947
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
948
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
949
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
950
- AxiosError.ECONNABORTED = 'ECONNABORTED';
951
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
952
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
953
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
954
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
955
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
956
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
957
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
958
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
959
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
960
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
961
-
962
- /**
963
- * Determines if the given thing is a array or js object.
964
- *
965
- * @param {string} thing - The object or array to be visited.
966
- *
967
- * @returns {boolean}
968
- */
969
- function isVisitable(thing) {
970
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
952
+ function normalizeHeader(header) {
953
+ return header && String(header).trim().toLowerCase();
971
954
  }
972
-
973
- /**
974
- * It removes the brackets from the end of a string
975
- *
976
- * @param {string} key - The key of the parameter.
977
- *
978
- * @returns {string} the key without the brackets.
979
- */
980
- function removeBrackets(key) {
981
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
955
+ function sanitizeHeaderValue(str) {
956
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
982
957
  }
983
-
984
- /**
985
- * It takes a path, a key, and a boolean, and returns a string
986
- *
987
- * @param {string} path - The path to the current key.
988
- * @param {string} key - The key of the current object being iterated over.
989
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
990
- *
991
- * @returns {string} The path to the current key.
992
- */
993
- function renderKey(path, key, dots) {
994
- if (!path) return key;
995
- return path.concat(key).map(function each(token, i) {
996
- // eslint-disable-next-line no-param-reassign
997
- token = removeBrackets(token);
998
- return !dots && i ? '[' + token + ']' : token;
999
- }).join(dots ? '.' : '');
958
+ function normalizeValue(value) {
959
+ if (value === false || value == null) {
960
+ return value;
961
+ }
962
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1000
963
  }
1001
-
1002
- /**
1003
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1004
- *
1005
- * @param {Array<any>} arr - The array to check
1006
- *
1007
- * @returns {boolean}
1008
- */
1009
- function isFlatArray(arr) {
1010
- return utils$1.isArray(arr) && !arr.some(isVisitable);
964
+ function parseTokens(str) {
965
+ const tokens = Object.create(null);
966
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
967
+ let match;
968
+ while (match = tokensRE.exec(str)) {
969
+ tokens[match[1]] = match[2];
970
+ }
971
+ return tokens;
1011
972
  }
1012
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1013
- return /^is[A-Z]/.test(prop);
1014
- });
1015
-
1016
- /**
1017
- * Convert a data object to FormData
1018
- *
1019
- * @param {Object} obj
1020
- * @param {?Object} [formData]
1021
- * @param {?Object} [options]
1022
- * @param {Function} [options.visitor]
1023
- * @param {Boolean} [options.metaTokens = true]
1024
- * @param {Boolean} [options.dots = false]
1025
- * @param {?Boolean} [options.indexes = false]
1026
- *
1027
- * @returns {Object}
1028
- **/
1029
-
1030
- /**
1031
- * It converts an object into a FormData object
1032
- *
1033
- * @param {Object<any, any>} obj - The object to convert to form data.
1034
- * @param {string} formData - The FormData object to append to.
1035
- * @param {Object<string, any>} options
1036
- *
1037
- * @returns
1038
- */
1039
- function toFormData(obj, formData, options) {
1040
- if (!utils$1.isObject(obj)) {
1041
- throw new TypeError('target must be an object');
973
+ const isValidHeaderName = str => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
974
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
975
+ if (utils$1.isFunction(filter)) {
976
+ return filter.call(this, value, header);
1042
977
  }
1043
-
1044
- // eslint-disable-next-line no-param-reassign
1045
- formData = formData || new (FormData$1 || FormData)();
1046
-
1047
- // eslint-disable-next-line no-param-reassign
1048
- options = utils$1.toFlatObject(options, {
1049
- metaTokens: true,
1050
- dots: false,
1051
- indexes: false
1052
- }, false, function defined(option, source) {
1053
- // eslint-disable-next-line no-eq-null,eqeqeq
1054
- return !utils$1.isUndefined(source[option]);
1055
- });
1056
- const metaTokens = options.metaTokens;
1057
- // eslint-disable-next-line no-use-before-define
1058
- const visitor = options.visitor || defaultVisitor;
1059
- const dots = options.dots;
1060
- const indexes = options.indexes;
1061
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1062
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1063
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1064
- if (!utils$1.isFunction(visitor)) {
1065
- throw new TypeError('visitor must be a function');
978
+ if (isHeaderNameFilter) {
979
+ value = header;
1066
980
  }
1067
- function convertValue(value) {
1068
- if (value === null) return '';
1069
- if (utils$1.isDate(value)) {
1070
- return value.toISOString();
1071
- }
1072
- if (utils$1.isBoolean(value)) {
1073
- return value.toString();
1074
- }
1075
- if (!useBlob && utils$1.isBlob(value)) {
1076
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
981
+ if (!utils$1.isString(value)) return;
982
+ if (utils$1.isString(filter)) {
983
+ return value.indexOf(filter) !== -1;
984
+ }
985
+ if (utils$1.isRegExp(filter)) {
986
+ return filter.test(value);
987
+ }
988
+ }
989
+ function formatHeader(header) {
990
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
991
+ return char.toUpperCase() + str;
992
+ });
993
+ }
994
+ function buildAccessors(obj, header) {
995
+ const accessorName = utils$1.toCamelCase(' ' + header);
996
+ ['get', 'set', 'has'].forEach(methodName => {
997
+ Object.defineProperty(obj, methodName + accessorName, {
998
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
999
+ // this data descriptor into an accessor descriptor on the way in.
1000
+ __proto__: null,
1001
+ value: function (arg1, arg2, arg3) {
1002
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1003
+ },
1004
+ configurable: true
1005
+ });
1006
+ });
1007
+ }
1008
+ class AxiosHeaders {
1009
+ constructor(headers) {
1010
+ headers && this.set(headers);
1011
+ }
1012
+ set(header, valueOrRewrite, rewrite) {
1013
+ const self = this;
1014
+ function setHeader(_value, _header, _rewrite) {
1015
+ const lHeader = normalizeHeader(_header);
1016
+ if (!lHeader) {
1017
+ throw new Error('header name must be a non-empty string');
1018
+ }
1019
+ const key = utils$1.findKey(self, lHeader);
1020
+ if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1021
+ self[key || _header] = normalizeValue(_value);
1022
+ }
1077
1023
  }
1078
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1079
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1024
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1025
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1026
+ setHeaders(header, valueOrRewrite);
1027
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1028
+ setHeaders(parseHeaders(header), valueOrRewrite);
1029
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1030
+ let obj = {},
1031
+ dest,
1032
+ key;
1033
+ for (const entry of header) {
1034
+ if (!utils$1.isArray(entry)) {
1035
+ throw TypeError('Object iterator must return a key-value pair');
1036
+ }
1037
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1038
+ }
1039
+ setHeaders(obj, valueOrRewrite);
1040
+ } else {
1041
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1080
1042
  }
1081
- return value;
1043
+ return this;
1082
1044
  }
1083
-
1084
- /**
1085
- * Default visitor.
1086
- *
1087
- * @param {*} value
1088
- * @param {String|Number} key
1089
- * @param {Array<String|Number>} path
1090
- * @this {FormData}
1091
- *
1092
- * @returns {boolean} return true to visit the each prop of the value recursively
1093
- */
1094
- function defaultVisitor(value, key, path) {
1095
- let arr = value;
1096
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1097
- formData.append(renderKey(path, key, dots), convertValue(value));
1098
- return false;
1099
- }
1100
- if (value && !path && typeof value === 'object') {
1101
- if (utils$1.endsWith(key, '{}')) {
1102
- // eslint-disable-next-line no-param-reassign
1103
- key = metaTokens ? key : key.slice(0, -2);
1104
- // eslint-disable-next-line no-param-reassign
1105
- value = JSON.stringify(value);
1106
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
1107
- // eslint-disable-next-line no-param-reassign
1108
- key = removeBrackets(key);
1109
- arr.forEach(function each(el, index) {
1110
- !(utils$1.isUndefined(el) || el === null) && formData.append(
1111
- // eslint-disable-next-line no-nested-ternary
1112
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
1113
- });
1114
- return false;
1045
+ get(header, parser) {
1046
+ header = normalizeHeader(header);
1047
+ if (header) {
1048
+ const key = utils$1.findKey(this, header);
1049
+ if (key) {
1050
+ const value = this[key];
1051
+ if (!parser) {
1052
+ return value;
1053
+ }
1054
+ if (parser === true) {
1055
+ return parseTokens(value);
1056
+ }
1057
+ if (utils$1.isFunction(parser)) {
1058
+ return parser.call(this, value, key);
1059
+ }
1060
+ if (utils$1.isRegExp(parser)) {
1061
+ return parser.exec(value);
1062
+ }
1063
+ throw new TypeError('parser must be boolean|regexp|function');
1115
1064
  }
1116
1065
  }
1117
- if (isVisitable(value)) {
1118
- return true;
1066
+ }
1067
+ has(header, matcher) {
1068
+ header = normalizeHeader(header);
1069
+ if (header) {
1070
+ const key = utils$1.findKey(this, header);
1071
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1119
1072
  }
1120
- formData.append(renderKey(path, key, dots), convertValue(value));
1121
1073
  return false;
1122
1074
  }
1123
- const stack = [];
1124
- const exposedHelpers = Object.assign(predicates, {
1125
- defaultVisitor,
1126
- convertValue,
1127
- isVisitable
1128
- });
1129
- function build(value, path, depth = 0) {
1130
- if (utils$1.isUndefined(value)) return;
1131
- if (depth > maxDepth) {
1132
- throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
1075
+ delete(header, matcher) {
1076
+ const self = this;
1077
+ let deleted = false;
1078
+ function deleteHeader(_header) {
1079
+ _header = normalizeHeader(_header);
1080
+ if (_header) {
1081
+ const key = utils$1.findKey(self, _header);
1082
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1083
+ delete self[key];
1084
+ deleted = true;
1085
+ }
1086
+ }
1133
1087
  }
1134
- if (stack.indexOf(value) !== -1) {
1135
- throw Error('Circular reference detected in ' + path.join('.'));
1088
+ if (utils$1.isArray(header)) {
1089
+ header.forEach(deleteHeader);
1090
+ } else {
1091
+ deleteHeader(header);
1136
1092
  }
1137
- stack.push(value);
1138
- utils$1.forEach(value, function each(el, key) {
1139
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1140
- if (result === true) {
1141
- build(el, path ? path.concat(key) : [key], depth + 1);
1093
+ return deleted;
1094
+ }
1095
+ clear(matcher) {
1096
+ const keys = Object.keys(this);
1097
+ let i = keys.length;
1098
+ let deleted = false;
1099
+ while (i--) {
1100
+ const key = keys[i];
1101
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1102
+ delete this[key];
1103
+ deleted = true;
1104
+ }
1105
+ }
1106
+ return deleted;
1107
+ }
1108
+ normalize(format) {
1109
+ const self = this;
1110
+ const headers = {};
1111
+ utils$1.forEach(this, (value, header) => {
1112
+ const key = utils$1.findKey(headers, header);
1113
+ if (key) {
1114
+ self[key] = normalizeValue(value);
1115
+ delete self[header];
1116
+ return;
1117
+ }
1118
+ const normalized = format ? formatHeader(header) : String(header).trim();
1119
+ if (normalized !== header) {
1120
+ delete self[header];
1142
1121
  }
1122
+ self[normalized] = normalizeValue(value);
1123
+ headers[normalized] = true;
1143
1124
  });
1144
- stack.pop();
1125
+ return this;
1145
1126
  }
1146
- if (!utils$1.isObject(obj)) {
1147
- throw new TypeError('data must be an object');
1127
+ concat(...targets) {
1128
+ return this.constructor.concat(this, ...targets);
1129
+ }
1130
+ toJSON(asStrings) {
1131
+ const obj = Object.create(null);
1132
+ utils$1.forEach(this, (value, header) => {
1133
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1134
+ });
1135
+ return obj;
1136
+ }
1137
+ [Symbol.iterator]() {
1138
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1139
+ }
1140
+ toString() {
1141
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1142
+ }
1143
+ getSetCookie() {
1144
+ return this.get('set-cookie') || [];
1145
+ }
1146
+ get [Symbol.toStringTag]() {
1147
+ return 'AxiosHeaders';
1148
+ }
1149
+ static from(thing) {
1150
+ return thing instanceof this ? thing : new this(thing);
1151
+ }
1152
+ static concat(first, ...targets) {
1153
+ const computed = new this(first);
1154
+ targets.forEach(target => computed.set(target));
1155
+ return computed;
1156
+ }
1157
+ static accessor(header) {
1158
+ const internals = this[$internals] = this[$internals] = {
1159
+ accessors: {}
1160
+ };
1161
+ const accessors = internals.accessors;
1162
+ const prototype = this.prototype;
1163
+ function defineAccessor(_header) {
1164
+ const lHeader = normalizeHeader(_header);
1165
+ if (!accessors[lHeader]) {
1166
+ buildAccessors(prototype, _header);
1167
+ accessors[lHeader] = true;
1168
+ }
1169
+ }
1170
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1171
+ return this;
1148
1172
  }
1149
- build(obj);
1150
- return formData;
1151
1173
  }
1174
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1152
1175
 
1153
- /**
1154
- * It encodes a string by replacing all characters that are not in the unreserved set with
1155
- * their percent-encoded equivalents
1156
- *
1157
- * @param {string} str - The string to encode.
1158
- *
1159
- * @returns {string} The encoded string.
1160
- */
1161
- function encode$1(str) {
1162
- const charMap = {
1163
- '!': '%21',
1164
- "'": '%27',
1165
- '(': '%28',
1166
- ')': '%29',
1167
- '~': '%7E',
1168
- '%20': '+'
1176
+ // reserved names hotfix
1177
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({
1178
+ value
1179
+ }, key) => {
1180
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1181
+ return {
1182
+ get: () => value,
1183
+ set(headerValue) {
1184
+ this[mapped] = headerValue;
1185
+ }
1169
1186
  };
1170
- return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
1171
- return charMap[match];
1172
- });
1187
+ });
1188
+ utils$1.freezeMethods(AxiosHeaders);
1189
+
1190
+ const REDACTED = '[REDACTED ****]';
1191
+ function hasOwnOrPrototypeToJSON(source) {
1192
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
1193
+ return true;
1194
+ }
1195
+ let prototype = Object.getPrototypeOf(source);
1196
+ while (prototype && prototype !== Object.prototype) {
1197
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
1198
+ return true;
1199
+ }
1200
+ prototype = Object.getPrototypeOf(prototype);
1201
+ }
1202
+ return false;
1203
+ }
1204
+
1205
+ // Build a plain-object snapshot of `config` and replace the value of any key
1206
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
1207
+ // and AxiosHeaders, and short-circuits on circular references.
1208
+ function redactConfig(config, redactKeys) {
1209
+ const lowerKeys = new Set(redactKeys.map(k => String(k).toLowerCase()));
1210
+ const seen = [];
1211
+ const visit = source => {
1212
+ if (source === null || typeof source !== 'object') return source;
1213
+ if (utils$1.isBuffer(source)) return source;
1214
+ if (seen.indexOf(source) !== -1) return undefined;
1215
+ if (source instanceof AxiosHeaders) {
1216
+ source = source.toJSON();
1217
+ }
1218
+ seen.push(source);
1219
+ let result;
1220
+ if (utils$1.isArray(source)) {
1221
+ result = [];
1222
+ source.forEach((v, i) => {
1223
+ const reducedValue = visit(v);
1224
+ if (!utils$1.isUndefined(reducedValue)) {
1225
+ result[i] = reducedValue;
1226
+ }
1227
+ });
1228
+ } else {
1229
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
1230
+ seen.pop();
1231
+ return source;
1232
+ }
1233
+ result = Object.create(null);
1234
+ for (const [key, value] of Object.entries(source)) {
1235
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
1236
+ if (!utils$1.isUndefined(reducedValue)) {
1237
+ result[key] = reducedValue;
1238
+ }
1239
+ }
1240
+ }
1241
+ seen.pop();
1242
+ return result;
1243
+ };
1244
+ return visit(config);
1245
+ }
1246
+ class AxiosError extends Error {
1247
+ static from(error, code, config, request, response, customProps) {
1248
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1249
+ axiosError.cause = error;
1250
+ axiosError.name = error.name;
1251
+
1252
+ // Preserve status from the original error if not already set from response
1253
+ if (error.status != null && axiosError.status == null) {
1254
+ axiosError.status = error.status;
1255
+ }
1256
+ customProps && Object.assign(axiosError, customProps);
1257
+ return axiosError;
1258
+ }
1259
+
1260
+ /**
1261
+ * Create an Error with the specified message, config, error code, request and response.
1262
+ *
1263
+ * @param {string} message The error message.
1264
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
1265
+ * @param {Object} [config] The config.
1266
+ * @param {Object} [request] The request.
1267
+ * @param {Object} [response] The response.
1268
+ *
1269
+ * @returns {Error} The created error.
1270
+ */
1271
+ constructor(message, code, config, request, response) {
1272
+ super(message);
1273
+
1274
+ // Make message enumerable to maintain backward compatibility
1275
+ // The native Error constructor sets message as non-enumerable,
1276
+ // but axios < v1.13.3 had it as enumerable
1277
+ Object.defineProperty(this, 'message', {
1278
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1279
+ // this data descriptor into an accessor descriptor on the way in.
1280
+ __proto__: null,
1281
+ value: message,
1282
+ enumerable: true,
1283
+ writable: true,
1284
+ configurable: true
1285
+ });
1286
+ this.name = 'AxiosError';
1287
+ this.isAxiosError = true;
1288
+ code && (this.code = code);
1289
+ config && (this.config = config);
1290
+ request && (this.request = request);
1291
+ if (response) {
1292
+ this.response = response;
1293
+ this.status = response.status;
1294
+ }
1295
+ }
1296
+ toJSON() {
1297
+ // Opt-in redaction: when the request config carries a `redact` array, the
1298
+ // value of any matching key (case-insensitive, at any depth) is replaced
1299
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
1300
+ // existing serialization behavior unchanged.
1301
+ const config = this.config;
1302
+ const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
1303
+ const serializedConfig = utils$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1.toJSONObject(config);
1304
+ return {
1305
+ // Standard
1306
+ message: this.message,
1307
+ name: this.name,
1308
+ // Microsoft
1309
+ description: this.description,
1310
+ number: this.number,
1311
+ // Mozilla
1312
+ fileName: this.fileName,
1313
+ lineNumber: this.lineNumber,
1314
+ columnNumber: this.columnNumber,
1315
+ stack: this.stack,
1316
+ // Axios
1317
+ config: serializedConfig,
1318
+ code: this.code,
1319
+ status: this.status
1320
+ };
1321
+ }
1173
1322
  }
1174
1323
 
1324
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1325
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1326
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1327
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
1328
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1329
+ AxiosError.ECONNREFUSED = 'ECONNREFUSED';
1330
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1331
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1332
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1333
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1334
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1335
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1336
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1337
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1338
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1339
+
1175
1340
  /**
1176
- * It takes a params object and converts it to a FormData object
1341
+ * Determines if the given thing is a array or js object.
1177
1342
  *
1178
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1179
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1343
+ * @param {string} thing - The object or array to be visited.
1180
1344
  *
1181
- * @returns {void}
1345
+ * @returns {boolean}
1182
1346
  */
1183
- function AxiosURLSearchParams(params, options) {
1184
- this._pairs = [];
1185
- params && toFormData(params, this, options);
1347
+ function isVisitable(thing) {
1348
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1186
1349
  }
1187
- const prototype = AxiosURLSearchParams.prototype;
1188
- prototype.append = function append(name, value) {
1189
- this._pairs.push([name, value]);
1190
- };
1191
- prototype.toString = function toString(encoder) {
1192
- const _encode = encoder ? function (value) {
1193
- return encoder.call(this, value, encode$1);
1194
- } : encode$1;
1195
- return this._pairs.map(function each(pair) {
1196
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1197
- }, '').join('&');
1198
- };
1199
1350
 
1200
1351
  /**
1201
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1202
- * their plain counterparts (`:`, `$`, `,`, `+`).
1352
+ * It removes the brackets from the end of a string
1203
1353
  *
1204
- * @param {string} val The value to be encoded.
1354
+ * @param {string} key - The key of the parameter.
1205
1355
  *
1206
- * @returns {string} The encoded value.
1356
+ * @returns {string} the key without the brackets.
1207
1357
  */
1208
- function encode(val) {
1209
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1358
+ function removeBrackets(key) {
1359
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1210
1360
  }
1211
1361
 
1212
1362
  /**
1213
- * Build a URL by appending params to the end
1363
+ * It takes a path, a key, and a boolean, and returns a string
1214
1364
  *
1215
- * @param {string} url The base of the url (e.g., http://www.google.com)
1216
- * @param {object} [params] The params to be appended
1217
- * @param {?(object|Function)} options
1365
+ * @param {string} path - The path to the current key.
1366
+ * @param {string} key - The key of the current object being iterated over.
1367
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1218
1368
  *
1219
- * @returns {string} The formatted url
1369
+ * @returns {string} The path to the current key.
1220
1370
  */
1221
- function buildURL(url, params, options) {
1222
- if (!params) {
1223
- return url;
1224
- }
1225
- const _encode = options && options.encode || encode;
1226
- const _options = utils$1.isFunction(options) ? {
1227
- serialize: options
1228
- } : options;
1229
- const serializeFn = _options && _options.serialize;
1230
- let serializedParams;
1231
- if (serializeFn) {
1232
- serializedParams = serializeFn(params, _options);
1233
- } else {
1234
- serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
1235
- }
1236
- if (serializedParams) {
1237
- const hashmarkIndex = url.indexOf('#');
1238
- if (hashmarkIndex !== -1) {
1239
- url = url.slice(0, hashmarkIndex);
1240
- }
1241
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1242
- }
1243
- return url;
1371
+ function renderKey(path, key, dots) {
1372
+ if (!path) return key;
1373
+ return path.concat(key).map(function each(token, i) {
1374
+ // eslint-disable-next-line no-param-reassign
1375
+ token = removeBrackets(token);
1376
+ return !dots && i ? '[' + token + ']' : token;
1377
+ }).join(dots ? '.' : '');
1244
1378
  }
1245
1379
 
1246
- class InterceptorManager {
1247
- constructor() {
1248
- this.handlers = [];
1249
- }
1380
+ /**
1381
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
1382
+ *
1383
+ * @param {Array<any>} arr - The array to check
1384
+ *
1385
+ * @returns {boolean}
1386
+ */
1387
+ function isFlatArray(arr) {
1388
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
1389
+ }
1390
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1391
+ return /^is[A-Z]/.test(prop);
1392
+ });
1250
1393
 
1251
- /**
1252
- * Add a new interceptor to the stack
1253
- *
1254
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1255
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1256
- * @param {Object} options The options for the interceptor, synchronous and runWhen
1257
- *
1258
- * @return {Number} An ID used to remove interceptor later
1259
- */
1260
- use(fulfilled, rejected, options) {
1261
- this.handlers.push({
1262
- fulfilled,
1263
- rejected,
1264
- synchronous: options ? options.synchronous : false,
1265
- runWhen: options ? options.runWhen : null
1266
- });
1267
- return this.handlers.length - 1;
1268
- }
1394
+ /**
1395
+ * Convert a data object to FormData
1396
+ *
1397
+ * @param {Object} obj
1398
+ * @param {?Object} [formData]
1399
+ * @param {?Object} [options]
1400
+ * @param {Function} [options.visitor]
1401
+ * @param {Boolean} [options.metaTokens = true]
1402
+ * @param {Boolean} [options.dots = false]
1403
+ * @param {?Boolean} [options.indexes = false]
1404
+ *
1405
+ * @returns {Object}
1406
+ **/
1269
1407
 
1270
- /**
1271
- * Remove an interceptor from the stack
1272
- *
1273
- * @param {Number} id The ID that was returned by `use`
1274
- *
1275
- * @returns {void}
1276
- */
1277
- eject(id) {
1278
- if (this.handlers[id]) {
1279
- this.handlers[id] = null;
1408
+ /**
1409
+ * It converts an object into a FormData object
1410
+ *
1411
+ * @param {Object<any, any>} obj - The object to convert to form data.
1412
+ * @param {string} formData - The FormData object to append to.
1413
+ * @param {Object<string, any>} options
1414
+ *
1415
+ * @returns
1416
+ */
1417
+ function toFormData(obj, formData, options) {
1418
+ if (!utils$1.isObject(obj)) {
1419
+ throw new TypeError('target must be an object');
1420
+ }
1421
+
1422
+ // eslint-disable-next-line no-param-reassign
1423
+ formData = formData || new (FormData$1 || FormData)();
1424
+
1425
+ // eslint-disable-next-line no-param-reassign
1426
+ options = utils$1.toFlatObject(options, {
1427
+ metaTokens: true,
1428
+ dots: false,
1429
+ indexes: false
1430
+ }, false, function defined(option, source) {
1431
+ // eslint-disable-next-line no-eq-null,eqeqeq
1432
+ return !utils$1.isUndefined(source[option]);
1433
+ });
1434
+ const metaTokens = options.metaTokens;
1435
+ // eslint-disable-next-line no-use-before-define
1436
+ const visitor = options.visitor || defaultVisitor;
1437
+ const dots = options.dots;
1438
+ const indexes = options.indexes;
1439
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1440
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1441
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1442
+ if (!utils$1.isFunction(visitor)) {
1443
+ throw new TypeError('visitor must be a function');
1444
+ }
1445
+ function convertValue(value) {
1446
+ if (value === null) return '';
1447
+ if (utils$1.isDate(value)) {
1448
+ return value.toISOString();
1449
+ }
1450
+ if (utils$1.isBoolean(value)) {
1451
+ return value.toString();
1452
+ }
1453
+ if (!useBlob && utils$1.isBlob(value)) {
1454
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1455
+ }
1456
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1457
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1458
+ }
1459
+ return value;
1460
+ }
1461
+
1462
+ /**
1463
+ * Default visitor.
1464
+ *
1465
+ * @param {*} value
1466
+ * @param {String|Number} key
1467
+ * @param {Array<String|Number>} path
1468
+ * @this {FormData}
1469
+ *
1470
+ * @returns {boolean} return true to visit the each prop of the value recursively
1471
+ */
1472
+ function defaultVisitor(value, key, path) {
1473
+ let arr = value;
1474
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1475
+ formData.append(renderKey(path, key, dots), convertValue(value));
1476
+ return false;
1477
+ }
1478
+ if (value && !path && typeof value === 'object') {
1479
+ if (utils$1.endsWith(key, '{}')) {
1480
+ // eslint-disable-next-line no-param-reassign
1481
+ key = metaTokens ? key : key.slice(0, -2);
1482
+ // eslint-disable-next-line no-param-reassign
1483
+ value = JSON.stringify(value);
1484
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
1485
+ // eslint-disable-next-line no-param-reassign
1486
+ key = removeBrackets(key);
1487
+ arr.forEach(function each(el, index) {
1488
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
1489
+ // eslint-disable-next-line no-nested-ternary
1490
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
1491
+ });
1492
+ return false;
1493
+ }
1494
+ }
1495
+ if (isVisitable(value)) {
1496
+ return true;
1497
+ }
1498
+ formData.append(renderKey(path, key, dots), convertValue(value));
1499
+ return false;
1500
+ }
1501
+ const stack = [];
1502
+ const exposedHelpers = Object.assign(predicates, {
1503
+ defaultVisitor,
1504
+ convertValue,
1505
+ isVisitable
1506
+ });
1507
+ function build(value, path, depth = 0) {
1508
+ if (utils$1.isUndefined(value)) return;
1509
+ if (depth > maxDepth) {
1510
+ throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
1511
+ }
1512
+ if (stack.indexOf(value) !== -1) {
1513
+ throw Error('Circular reference detected in ' + path.join('.'));
1514
+ }
1515
+ stack.push(value);
1516
+ utils$1.forEach(value, function each(el, key) {
1517
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1518
+ if (result === true) {
1519
+ build(el, path ? path.concat(key) : [key], depth + 1);
1520
+ }
1521
+ });
1522
+ stack.pop();
1523
+ }
1524
+ if (!utils$1.isObject(obj)) {
1525
+ throw new TypeError('data must be an object');
1526
+ }
1527
+ build(obj);
1528
+ return formData;
1529
+ }
1530
+
1531
+ /**
1532
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1533
+ * their percent-encoded equivalents
1534
+ *
1535
+ * @param {string} str - The string to encode.
1536
+ *
1537
+ * @returns {string} The encoded string.
1538
+ */
1539
+ function encode$1(str) {
1540
+ const charMap = {
1541
+ '!': '%21',
1542
+ "'": '%27',
1543
+ '(': '%28',
1544
+ ')': '%29',
1545
+ '~': '%7E',
1546
+ '%20': '+'
1547
+ };
1548
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
1549
+ return charMap[match];
1550
+ });
1551
+ }
1552
+
1553
+ /**
1554
+ * It takes a params object and converts it to a FormData object
1555
+ *
1556
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1557
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1558
+ *
1559
+ * @returns {void}
1560
+ */
1561
+ function AxiosURLSearchParams(params, options) {
1562
+ this._pairs = [];
1563
+ params && toFormData(params, this, options);
1564
+ }
1565
+ const prototype = AxiosURLSearchParams.prototype;
1566
+ prototype.append = function append(name, value) {
1567
+ this._pairs.push([name, value]);
1568
+ };
1569
+ prototype.toString = function toString(encoder) {
1570
+ const _encode = encoder ? function (value) {
1571
+ return encoder.call(this, value, encode$1);
1572
+ } : encode$1;
1573
+ return this._pairs.map(function each(pair) {
1574
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1575
+ }, '').join('&');
1576
+ };
1577
+
1578
+ /**
1579
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1580
+ * their plain counterparts (`:`, `$`, `,`, `+`).
1581
+ *
1582
+ * @param {string} val The value to be encoded.
1583
+ *
1584
+ * @returns {string} The encoded value.
1585
+ */
1586
+ function encode(val) {
1587
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1588
+ }
1589
+
1590
+ /**
1591
+ * Build a URL by appending params to the end
1592
+ *
1593
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1594
+ * @param {object} [params] The params to be appended
1595
+ * @param {?(object|Function)} options
1596
+ *
1597
+ * @returns {string} The formatted url
1598
+ */
1599
+ function buildURL(url, params, options) {
1600
+ if (!params) {
1601
+ return url;
1602
+ }
1603
+ const _encode = options && options.encode || encode;
1604
+ const _options = utils$1.isFunction(options) ? {
1605
+ serialize: options
1606
+ } : options;
1607
+ const serializeFn = _options && _options.serialize;
1608
+ let serializedParams;
1609
+ if (serializeFn) {
1610
+ serializedParams = serializeFn(params, _options);
1611
+ } else {
1612
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
1613
+ }
1614
+ if (serializedParams) {
1615
+ const hashmarkIndex = url.indexOf('#');
1616
+ if (hashmarkIndex !== -1) {
1617
+ url = url.slice(0, hashmarkIndex);
1618
+ }
1619
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1620
+ }
1621
+ return url;
1622
+ }
1623
+
1624
+ class InterceptorManager {
1625
+ constructor() {
1626
+ this.handlers = [];
1627
+ }
1628
+
1629
+ /**
1630
+ * Add a new interceptor to the stack
1631
+ *
1632
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1633
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1634
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
1635
+ *
1636
+ * @return {Number} An ID used to remove interceptor later
1637
+ */
1638
+ use(fulfilled, rejected, options) {
1639
+ this.handlers.push({
1640
+ fulfilled,
1641
+ rejected,
1642
+ synchronous: options ? options.synchronous : false,
1643
+ runWhen: options ? options.runWhen : null
1644
+ });
1645
+ return this.handlers.length - 1;
1646
+ }
1647
+
1648
+ /**
1649
+ * Remove an interceptor from the stack
1650
+ *
1651
+ * @param {Number} id The ID that was returned by `use`
1652
+ *
1653
+ * @returns {void}
1654
+ */
1655
+ eject(id) {
1656
+ if (this.handlers[id]) {
1657
+ this.handlers[id] = null;
1280
1658
  }
1281
1659
  }
1282
1660
 
@@ -1482,435 +1860,136 @@ function formDataToJSON(formData) {
1482
1860
  target[name] = arrayToObject(target[name]);
1483
1861
  }
1484
1862
  return !isNumericKey;
1485
- }
1486
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1487
- const obj = {};
1488
- utils$1.forEachEntry(formData, (name, value) => {
1489
- buildPath(parsePropPath(name), value, obj, 0);
1490
- });
1491
- return obj;
1492
- }
1493
- return null;
1494
- }
1495
-
1496
- const own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
1497
-
1498
- /**
1499
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1500
- * of the input
1501
- *
1502
- * @param {any} rawValue - The value to be stringified.
1503
- * @param {Function} parser - A function that parses a string into a JavaScript object.
1504
- * @param {Function} encoder - A function that takes a value and returns a string.
1505
- *
1506
- * @returns {string} A stringified version of the rawValue.
1507
- */
1508
- function stringifySafely(rawValue, parser, encoder) {
1509
- if (utils$1.isString(rawValue)) {
1510
- try {
1511
- (parser || JSON.parse)(rawValue);
1512
- return utils$1.trim(rawValue);
1513
- } catch (e) {
1514
- if (e.name !== 'SyntaxError') {
1515
- throw e;
1516
- }
1517
- }
1518
- }
1519
- return (encoder || JSON.stringify)(rawValue);
1520
- }
1521
- const defaults = {
1522
- transitional: transitionalDefaults,
1523
- adapter: ['xhr', 'http', 'fetch'],
1524
- transformRequest: [function transformRequest(data, headers) {
1525
- const contentType = headers.getContentType() || '';
1526
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
1527
- const isObjectPayload = utils$1.isObject(data);
1528
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1529
- data = new FormData(data);
1530
- }
1531
- const isFormData = utils$1.isFormData(data);
1532
- if (isFormData) {
1533
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1534
- }
1535
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1536
- return data;
1537
- }
1538
- if (utils$1.isArrayBufferView(data)) {
1539
- return data.buffer;
1540
- }
1541
- if (utils$1.isURLSearchParams(data)) {
1542
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1543
- return data.toString();
1544
- }
1545
- let isFileList;
1546
- if (isObjectPayload) {
1547
- const formSerializer = own(this, 'formSerializer');
1548
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1549
- return toURLEncodedForm(data, formSerializer).toString();
1550
- }
1551
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1552
- const env = own(this, 'env');
1553
- const _FormData = env && env.FormData;
1554
- return toFormData(isFileList ? {
1555
- 'files[]': data
1556
- } : data, _FormData && new _FormData(), formSerializer);
1557
- }
1558
- }
1559
- if (isObjectPayload || hasJSONContentType) {
1560
- headers.setContentType('application/json', false);
1561
- return stringifySafely(data);
1562
- }
1563
- return data;
1564
- }],
1565
- transformResponse: [function transformResponse(data) {
1566
- const transitional = own(this, 'transitional') || defaults.transitional;
1567
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1568
- const responseType = own(this, 'responseType');
1569
- const JSONRequested = responseType === 'json';
1570
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1571
- return data;
1572
- }
1573
- if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
1574
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
1575
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1576
- try {
1577
- return JSON.parse(data, own(this, 'parseReviver'));
1578
- } catch (e) {
1579
- if (strictJSONParsing) {
1580
- if (e.name === 'SyntaxError') {
1581
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
1582
- }
1583
- throw e;
1584
- }
1585
- }
1586
- }
1587
- return data;
1588
- }],
1589
- /**
1590
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1591
- * timeout is not created.
1592
- */
1593
- timeout: 0,
1594
- xsrfCookieName: 'XSRF-TOKEN',
1595
- xsrfHeaderName: 'X-XSRF-TOKEN',
1596
- maxContentLength: -1,
1597
- maxBodyLength: -1,
1598
- env: {
1599
- FormData: platform.classes.FormData,
1600
- Blob: platform.classes.Blob
1601
- },
1602
- validateStatus: function validateStatus(status) {
1603
- return status >= 200 && status < 300;
1604
- },
1605
- headers: {
1606
- common: {
1607
- Accept: 'application/json, text/plain, */*',
1608
- 'Content-Type': undefined
1609
- }
1610
- }
1611
- };
1612
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], method => {
1613
- defaults.headers[method] = {};
1614
- });
1615
-
1616
- // RawAxiosHeaders whose duplicates are ignored by node
1617
- // c.f. https://nodejs.org/api/http.html#http_message_headers
1618
- const ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
1619
-
1620
- /**
1621
- * Parse headers into an object
1622
- *
1623
- * ```
1624
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
1625
- * Content-Type: application/json
1626
- * Connection: keep-alive
1627
- * Transfer-Encoding: chunked
1628
- * ```
1629
- *
1630
- * @param {String} rawHeaders Headers needing to be parsed
1631
- *
1632
- * @returns {Object} Headers parsed into an object
1633
- */
1634
- var parseHeaders = rawHeaders => {
1635
- const parsed = {};
1636
- let key;
1637
- let val;
1638
- let i;
1639
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1640
- i = line.indexOf(':');
1641
- key = line.substring(0, i).trim().toLowerCase();
1642
- val = line.substring(i + 1).trim();
1643
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1644
- return;
1645
- }
1646
- if (key === 'set-cookie') {
1647
- if (parsed[key]) {
1648
- parsed[key].push(val);
1649
- } else {
1650
- parsed[key] = [val];
1651
- }
1652
- } else {
1653
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1654
- }
1655
- });
1656
- return parsed;
1657
- };
1658
-
1659
- const $internals = Symbol('internals');
1660
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1661
- function trimSPorHTAB(str) {
1662
- let start = 0;
1663
- let end = str.length;
1664
- while (start < end) {
1665
- const code = str.charCodeAt(start);
1666
- if (code !== 0x09 && code !== 0x20) {
1667
- break;
1668
- }
1669
- start += 1;
1670
- }
1671
- while (end > start) {
1672
- const code = str.charCodeAt(end - 1);
1673
- if (code !== 0x09 && code !== 0x20) {
1674
- break;
1675
- }
1676
- end -= 1;
1677
- }
1678
- return start === 0 && end === str.length ? str : str.slice(start, end);
1679
- }
1680
- function normalizeHeader(header) {
1681
- return header && String(header).trim().toLowerCase();
1682
- }
1683
- function sanitizeHeaderValue(str) {
1684
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1685
- }
1686
- function normalizeValue(value) {
1687
- if (value === false || value == null) {
1688
- return value;
1689
- }
1690
- return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1691
- }
1692
- function parseTokens(str) {
1693
- const tokens = Object.create(null);
1694
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1695
- let match;
1696
- while (match = tokensRE.exec(str)) {
1697
- tokens[match[1]] = match[2];
1698
- }
1699
- return tokens;
1700
- }
1701
- const isValidHeaderName = str => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1702
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1703
- if (utils$1.isFunction(filter)) {
1704
- return filter.call(this, value, header);
1705
- }
1706
- if (isHeaderNameFilter) {
1707
- value = header;
1708
- }
1709
- if (!utils$1.isString(value)) return;
1710
- if (utils$1.isString(filter)) {
1711
- return value.indexOf(filter) !== -1;
1712
- }
1713
- if (utils$1.isRegExp(filter)) {
1714
- return filter.test(value);
1715
- }
1716
- }
1717
- function formatHeader(header) {
1718
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1719
- return char.toUpperCase() + str;
1720
- });
1721
- }
1722
- function buildAccessors(obj, header) {
1723
- const accessorName = utils$1.toCamelCase(' ' + header);
1724
- ['get', 'set', 'has'].forEach(methodName => {
1725
- Object.defineProperty(obj, methodName + accessorName, {
1726
- value: function (arg1, arg2, arg3) {
1727
- return this[methodName].call(this, header, arg1, arg2, arg3);
1728
- },
1729
- configurable: true
1730
- });
1731
- });
1732
- }
1733
- class AxiosHeaders {
1734
- constructor(headers) {
1735
- headers && this.set(headers);
1736
- }
1737
- set(header, valueOrRewrite, rewrite) {
1738
- const self = this;
1739
- function setHeader(_value, _header, _rewrite) {
1740
- const lHeader = normalizeHeader(_header);
1741
- if (!lHeader) {
1742
- throw new Error('header name must be a non-empty string');
1743
- }
1744
- const key = utils$1.findKey(self, lHeader);
1745
- if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1746
- self[key || _header] = normalizeValue(_value);
1747
- }
1748
- }
1749
- const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1750
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1751
- setHeaders(header, valueOrRewrite);
1752
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1753
- setHeaders(parseHeaders(header), valueOrRewrite);
1754
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1755
- let obj = {},
1756
- dest,
1757
- key;
1758
- for (const entry of header) {
1759
- if (!utils$1.isArray(entry)) {
1760
- throw TypeError('Object iterator must return a key-value pair');
1761
- }
1762
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1763
- }
1764
- setHeaders(obj, valueOrRewrite);
1765
- } else {
1766
- header != null && setHeader(valueOrRewrite, header, rewrite);
1767
- }
1768
- return this;
1769
- }
1770
- get(header, parser) {
1771
- header = normalizeHeader(header);
1772
- if (header) {
1773
- const key = utils$1.findKey(this, header);
1774
- if (key) {
1775
- const value = this[key];
1776
- if (!parser) {
1777
- return value;
1778
- }
1779
- if (parser === true) {
1780
- return parseTokens(value);
1781
- }
1782
- if (utils$1.isFunction(parser)) {
1783
- return parser.call(this, value, key);
1784
- }
1785
- if (utils$1.isRegExp(parser)) {
1786
- return parser.exec(value);
1787
- }
1788
- throw new TypeError('parser must be boolean|regexp|function');
1789
- }
1790
- }
1791
- }
1792
- has(header, matcher) {
1793
- header = normalizeHeader(header);
1794
- if (header) {
1795
- const key = utils$1.findKey(this, header);
1796
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1797
- }
1798
- return false;
1799
- }
1800
- delete(header, matcher) {
1801
- const self = this;
1802
- let deleted = false;
1803
- function deleteHeader(_header) {
1804
- _header = normalizeHeader(_header);
1805
- if (_header) {
1806
- const key = utils$1.findKey(self, _header);
1807
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1808
- delete self[key];
1809
- deleted = true;
1810
- }
1811
- }
1812
- }
1813
- if (utils$1.isArray(header)) {
1814
- header.forEach(deleteHeader);
1815
- } else {
1816
- deleteHeader(header);
1817
- }
1818
- return deleted;
1819
- }
1820
- clear(matcher) {
1821
- const keys = Object.keys(this);
1822
- let i = keys.length;
1823
- let deleted = false;
1824
- while (i--) {
1825
- const key = keys[i];
1826
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1827
- delete this[key];
1828
- deleted = true;
1829
- }
1830
- }
1831
- return deleted;
1832
- }
1833
- normalize(format) {
1834
- const self = this;
1835
- const headers = {};
1836
- utils$1.forEach(this, (value, header) => {
1837
- const key = utils$1.findKey(headers, header);
1838
- if (key) {
1839
- self[key] = normalizeValue(value);
1840
- delete self[header];
1841
- return;
1842
- }
1843
- const normalized = format ? formatHeader(header) : String(header).trim();
1844
- if (normalized !== header) {
1845
- delete self[header];
1846
- }
1847
- self[normalized] = normalizeValue(value);
1848
- headers[normalized] = true;
1849
- });
1850
- return this;
1851
- }
1852
- concat(...targets) {
1853
- return this.constructor.concat(this, ...targets);
1854
- }
1855
- toJSON(asStrings) {
1856
- const obj = Object.create(null);
1857
- utils$1.forEach(this, (value, header) => {
1858
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1863
+ }
1864
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1865
+ const obj = {};
1866
+ utils$1.forEachEntry(formData, (name, value) => {
1867
+ buildPath(parsePropPath(name), value, obj, 0);
1859
1868
  });
1860
1869
  return obj;
1861
1870
  }
1862
- [Symbol.iterator]() {
1863
- return Object.entries(this.toJSON())[Symbol.iterator]();
1864
- }
1865
- toString() {
1866
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1867
- }
1868
- getSetCookie() {
1869
- return this.get('set-cookie') || [];
1870
- }
1871
- get [Symbol.toStringTag]() {
1872
- return 'AxiosHeaders';
1873
- }
1874
- static from(thing) {
1875
- return thing instanceof this ? thing : new this(thing);
1876
- }
1877
- static concat(first, ...targets) {
1878
- const computed = new this(first);
1879
- targets.forEach(target => computed.set(target));
1880
- return computed;
1881
- }
1882
- static accessor(header) {
1883
- const internals = this[$internals] = this[$internals] = {
1884
- accessors: {}
1885
- };
1886
- const accessors = internals.accessors;
1887
- const prototype = this.prototype;
1888
- function defineAccessor(_header) {
1889
- const lHeader = normalizeHeader(_header);
1890
- if (!accessors[lHeader]) {
1891
- buildAccessors(prototype, _header);
1892
- accessors[lHeader] = true;
1871
+ return null;
1872
+ }
1873
+
1874
+ const own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
1875
+
1876
+ /**
1877
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1878
+ * of the input
1879
+ *
1880
+ * @param {any} rawValue - The value to be stringified.
1881
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
1882
+ * @param {Function} encoder - A function that takes a value and returns a string.
1883
+ *
1884
+ * @returns {string} A stringified version of the rawValue.
1885
+ */
1886
+ function stringifySafely(rawValue, parser, encoder) {
1887
+ if (utils$1.isString(rawValue)) {
1888
+ try {
1889
+ (parser || JSON.parse)(rawValue);
1890
+ return utils$1.trim(rawValue);
1891
+ } catch (e) {
1892
+ if (e.name !== 'SyntaxError') {
1893
+ throw e;
1893
1894
  }
1894
1895
  }
1895
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1896
- return this;
1897
1896
  }
1897
+ return (encoder || JSON.stringify)(rawValue);
1898
1898
  }
1899
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1900
-
1901
- // reserved names hotfix
1902
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({
1903
- value
1904
- }, key) => {
1905
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1906
- return {
1907
- get: () => value,
1908
- set(headerValue) {
1909
- this[mapped] = headerValue;
1899
+ const defaults = {
1900
+ transitional: transitionalDefaults,
1901
+ adapter: ['xhr', 'http', 'fetch'],
1902
+ transformRequest: [function transformRequest(data, headers) {
1903
+ const contentType = headers.getContentType() || '';
1904
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1905
+ const isObjectPayload = utils$1.isObject(data);
1906
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1907
+ data = new FormData(data);
1910
1908
  }
1911
- };
1909
+ const isFormData = utils$1.isFormData(data);
1910
+ if (isFormData) {
1911
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1912
+ }
1913
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1914
+ return data;
1915
+ }
1916
+ if (utils$1.isArrayBufferView(data)) {
1917
+ return data.buffer;
1918
+ }
1919
+ if (utils$1.isURLSearchParams(data)) {
1920
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1921
+ return data.toString();
1922
+ }
1923
+ let isFileList;
1924
+ if (isObjectPayload) {
1925
+ const formSerializer = own(this, 'formSerializer');
1926
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1927
+ return toURLEncodedForm(data, formSerializer).toString();
1928
+ }
1929
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1930
+ const env = own(this, 'env');
1931
+ const _FormData = env && env.FormData;
1932
+ return toFormData(isFileList ? {
1933
+ 'files[]': data
1934
+ } : data, _FormData && new _FormData(), formSerializer);
1935
+ }
1936
+ }
1937
+ if (isObjectPayload || hasJSONContentType) {
1938
+ headers.setContentType('application/json', false);
1939
+ return stringifySafely(data);
1940
+ }
1941
+ return data;
1942
+ }],
1943
+ transformResponse: [function transformResponse(data) {
1944
+ const transitional = own(this, 'transitional') || defaults.transitional;
1945
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1946
+ const responseType = own(this, 'responseType');
1947
+ const JSONRequested = responseType === 'json';
1948
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1949
+ return data;
1950
+ }
1951
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
1952
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
1953
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1954
+ try {
1955
+ return JSON.parse(data, own(this, 'parseReviver'));
1956
+ } catch (e) {
1957
+ if (strictJSONParsing) {
1958
+ if (e.name === 'SyntaxError') {
1959
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
1960
+ }
1961
+ throw e;
1962
+ }
1963
+ }
1964
+ }
1965
+ return data;
1966
+ }],
1967
+ /**
1968
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1969
+ * timeout is not created.
1970
+ */
1971
+ timeout: 0,
1972
+ xsrfCookieName: 'XSRF-TOKEN',
1973
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1974
+ maxContentLength: -1,
1975
+ maxBodyLength: -1,
1976
+ env: {
1977
+ FormData: platform.classes.FormData,
1978
+ Blob: platform.classes.Blob
1979
+ },
1980
+ validateStatus: function validateStatus(status) {
1981
+ return status >= 200 && status < 300;
1982
+ },
1983
+ headers: {
1984
+ common: {
1985
+ Accept: 'application/json, text/plain, */*',
1986
+ 'Content-Type': undefined
1987
+ }
1988
+ }
1989
+ };
1990
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], method => {
1991
+ defaults.headers[method] = {};
1912
1992
  });
1913
- utils$1.freezeMethods(AxiosHeaders);
1914
1993
 
1915
1994
  /**
1916
1995
  * Transform the data for a request or a response
@@ -1967,7 +2046,7 @@ function settle(resolve, reject, response) {
1967
2046
  if (!response.status || !validateStatus || validateStatus(response.status)) {
1968
2047
  resolve(response);
1969
2048
  } else {
1970
- reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
2049
+ reject(new AxiosError('Request failed with status code ' + response.status, response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE, response.config, response.request, response));
1971
2050
  }
1972
2051
  }
1973
2052
 
@@ -2114,10 +2193,10 @@ function getEnv(key) {
2114
2193
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
2115
2194
  }
2116
2195
 
2117
- const VERSION = "1.15.2";
2196
+ const VERSION = "1.16.0";
2118
2197
 
2119
2198
  function parseProtocol(url) {
2120
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2199
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2121
2200
  return match && match[1] || '';
2122
2201
  }
2123
2202
 
@@ -2344,7 +2423,7 @@ const formDataToStream = (form, headersHandler, options) => {
2344
2423
  throw TypeError('FormData instance required');
2345
2424
  }
2346
2425
  if (boundary.length < 1 || boundary.length > 70) {
2347
- throw Error('boundary must be 10-70 characters long');
2426
+ throw Error('boundary must be 1-70 characters long');
2348
2427
  }
2349
2428
  const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
2350
2429
  const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
@@ -2477,6 +2556,27 @@ const parseNoProxyEntry = entry => {
2477
2556
  }
2478
2557
  return [entryHost, entryPort];
2479
2558
  };
2559
+
2560
+ // Convert IPv4-mapped IPv6 (::ffff:0:0/96 prefix) to IPv4 dotted form so both
2561
+ // sides of a NO_PROXY comparison see the same canonical address. Without this,
2562
+ // `NO_PROXY=192.168.1.5` would not match a request to `http://[::ffff:192.168.1.5]/`
2563
+ // (Node's URL parser normalises that to `[::ffff:c0a8:105]`), and vice-versa,
2564
+ // allowing the proxy-bypass policy to be circumvented by using the alternate
2565
+ // representation. Returns the input unchanged when not IPv4-mapped.
2566
+ const IPV4_MAPPED_DOTTED_RE = /^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:(\d+\.\d+\.\d+\.\d+)$/i;
2567
+ const IPV4_MAPPED_HEX_RE = /^(?:::|(?:0{1,4}:){1,4}:|(?:0{1,4}:){5})ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i;
2568
+ const unmapIPv4MappedIPv6 = host => {
2569
+ if (typeof host !== 'string' || host.indexOf(':') === -1) return host;
2570
+ const dotted = host.match(IPV4_MAPPED_DOTTED_RE);
2571
+ if (dotted) return dotted[1];
2572
+ const hex = host.match(IPV4_MAPPED_HEX_RE);
2573
+ if (hex) {
2574
+ const high = parseInt(hex[1], 16);
2575
+ const low = parseInt(hex[2], 16);
2576
+ return `${high >> 8}.${high & 0xff}.${low >> 8}.${low & 0xff}`;
2577
+ }
2578
+ return host;
2579
+ };
2480
2580
  const normalizeNoProxyHost = hostname => {
2481
2581
  if (!hostname) {
2482
2582
  return hostname;
@@ -2484,7 +2584,7 @@ const normalizeNoProxyHost = hostname => {
2484
2584
  if (hostname.charAt(0) === '[' && hostname.charAt(hostname.length - 1) === ']') {
2485
2585
  hostname = hostname.slice(1, -1);
2486
2586
  }
2487
- return hostname.replace(/\.+$/, '');
2587
+ return unmapIPv4MappedIPv6(hostname.replace(/\.+$/, ''));
2488
2588
  };
2489
2589
  function shouldBypassProxy(location) {
2490
2590
  let parsed;
@@ -2697,7 +2797,34 @@ function estimateDataURLDecodedBytes(url) {
2697
2797
  const bytes = groups * 3 - (pad || 0);
2698
2798
  return bytes > 0 ? bytes : 0;
2699
2799
  }
2700
- return Buffer.byteLength(body, 'utf8');
2800
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
2801
+ return Buffer.byteLength(body, 'utf8');
2802
+ }
2803
+
2804
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
2805
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
2806
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
2807
+ // but 3 UTF-8 bytes).
2808
+ let bytes = 0;
2809
+ for (let i = 0, len = body.length; i < len; i++) {
2810
+ const c = body.charCodeAt(i);
2811
+ if (c < 0x80) {
2812
+ bytes += 1;
2813
+ } else if (c < 0x800) {
2814
+ bytes += 2;
2815
+ } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
2816
+ const next = body.charCodeAt(i + 1);
2817
+ if (next >= 0xdc00 && next <= 0xdfff) {
2818
+ bytes += 4;
2819
+ i++;
2820
+ } else {
2821
+ bytes += 3;
2822
+ }
2823
+ } else {
2824
+ bytes += 3;
2825
+ }
2826
+ }
2827
+ return bytes;
2701
2828
  }
2702
2829
 
2703
2830
  const zlibOptions = {
@@ -2714,6 +2841,18 @@ const {
2714
2841
  https: httpsFollow
2715
2842
  } = followRedirects;
2716
2843
  const isHttps = /https:?/;
2844
+ const FORM_DATA_CONTENT_HEADERS$1 = ['content-type', 'content-length'];
2845
+ function setFormDataHeaders$1(headers, formHeaders, policy) {
2846
+ if (policy !== 'content-only') {
2847
+ headers.set(formHeaders);
2848
+ return;
2849
+ }
2850
+ Object.entries(formHeaders).forEach(([key, val]) => {
2851
+ if (FORM_DATA_CONTENT_HEADERS$1.includes(key.toLowerCase())) {
2852
+ headers.set(key, val);
2853
+ }
2854
+ });
2855
+ }
2717
2856
 
2718
2857
  // Symbols used to bind a single 'error' listener to a pooled socket and track
2719
2858
  // the request currently owning that socket across keep-alive reuse (issue #10780).
@@ -2722,6 +2861,21 @@ const kAxiosCurrentReq = Symbol('axios.http.currentReq');
2722
2861
  const supportedProtocols = platform.protocols.map(protocol => {
2723
2862
  return protocol + ':';
2724
2863
  });
2864
+
2865
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
2866
+ // Decode before composing the `auth` option so credentials such as
2867
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
2868
+ // original value for malformed input so a bad encoding never throws.
2869
+ const decodeURIComponentSafe = value => {
2870
+ if (!utils$1.isString(value)) {
2871
+ return value;
2872
+ }
2873
+ try {
2874
+ return decodeURIComponent(value);
2875
+ } catch (error) {
2876
+ return value;
2877
+ }
2878
+ };
2725
2879
  const flushOnFinish = (stream, [throttled, flush]) => {
2726
2880
  stream.on('end', flush).on('error', flush);
2727
2881
  return throttled;
@@ -2809,12 +2963,12 @@ const http2Sessions = new Http2Sessions();
2809
2963
  *
2810
2964
  * @returns {Object<string, any>}
2811
2965
  */
2812
- function dispatchBeforeRedirect(options, responseDetails) {
2966
+ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
2813
2967
  if (options.beforeRedirects.proxy) {
2814
2968
  options.beforeRedirects.proxy(options);
2815
2969
  }
2816
2970
  if (options.beforeRedirects.config) {
2817
- options.beforeRedirects.config(options, responseDetails);
2971
+ options.beforeRedirects.config(options, responseDetails, requestDetails);
2818
2972
  }
2819
2973
  }
2820
2974
 
@@ -2827,7 +2981,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
2827
2981
  *
2828
2982
  * @returns {http.ClientRequestArgs}
2829
2983
  */
2830
- function setProxy(options, configProxy, location) {
2984
+ function setProxy(options, configProxy, location, isRedirect) {
2831
2985
  let proxy = configProxy;
2832
2986
  if (!proxy && proxy !== false) {
2833
2987
  const proxyUrl = getProxyForUrl(location);
@@ -2837,39 +2991,80 @@ function setProxy(options, configProxy, location) {
2837
2991
  }
2838
2992
  }
2839
2993
  }
2994
+ // On redirect re-invocation, strip any stale Proxy-Authorization header carried
2995
+ // over from the prior request (e.g. new target no longer uses a proxy, or uses
2996
+ // a different proxy). Skip on the initial request so user-supplied headers are
2997
+ // preserved. Header names are case-insensitive, so remove every case variant.
2998
+ if (isRedirect && options.headers) {
2999
+ for (const name of Object.keys(options.headers)) {
3000
+ if (name.toLowerCase() === 'proxy-authorization') {
3001
+ delete options.headers[name];
3002
+ }
3003
+ }
3004
+ }
2840
3005
  if (proxy) {
3006
+ // Read proxy fields without traversing the prototype chain. URL instances expose
3007
+ // username/password/hostname/host/port/protocol via getters on URL.prototype (so
3008
+ // direct reads are shielded), but plain object proxies — and the `auth` field
3009
+ // (which URL does not expose) — must be guarded so a polluted Object.prototype
3010
+ // (e.g. Object.prototype.auth = { username, password }) cannot inject
3011
+ // attacker-controlled credentials into the Proxy-Authorization header or
3012
+ // redirect proxying to an attacker-controlled host.
3013
+ const isProxyURL = proxy instanceof URL;
3014
+ const readProxyField = key => isProxyURL || utils$1.hasOwnProp(proxy, key) ? proxy[key] : undefined;
3015
+ const proxyUsername = readProxyField('username');
3016
+ const proxyPassword = readProxyField('password');
3017
+ let proxyAuth = utils$1.hasOwnProp(proxy, 'auth') ? proxy.auth : undefined;
3018
+
2841
3019
  // Basic proxy authorization
2842
- if (proxy.username) {
2843
- proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');
2844
- }
2845
- if (proxy.auth) {
2846
- // Support proxy auth object form
2847
- const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
3020
+ if (proxyUsername) {
3021
+ proxyAuth = (proxyUsername || '') + ':' + (proxyPassword || '');
3022
+ }
3023
+ if (proxyAuth) {
3024
+ // Support proxy auth object form. Read sub-fields via own-prop checks so a
3025
+ // plain object inheriting from polluted Object.prototype cannot leak creds.
3026
+ const authIsObject = typeof proxyAuth === 'object';
3027
+ const authUsername = authIsObject && utils$1.hasOwnProp(proxyAuth, 'username') ? proxyAuth.username : undefined;
3028
+ const authPassword = authIsObject && utils$1.hasOwnProp(proxyAuth, 'password') ? proxyAuth.password : undefined;
3029
+ const validProxyAuth = Boolean(authUsername || authPassword);
2848
3030
  if (validProxyAuth) {
2849
- proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
2850
- } else if (typeof proxy.auth === 'object') {
3031
+ proxyAuth = (authUsername || '') + ':' + (authPassword || '');
3032
+ } else if (authIsObject) {
2851
3033
  throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, {
2852
3034
  proxy
2853
3035
  });
2854
3036
  }
2855
- const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
3037
+ const base64 = Buffer.from(proxyAuth, 'utf8').toString('base64');
2856
3038
  options.headers['Proxy-Authorization'] = 'Basic ' + base64;
2857
3039
  }
2858
- options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
2859
- const proxyHost = proxy.hostname || proxy.host;
3040
+
3041
+ // Preserve a user-supplied Host header (case-insensitive) so callers can override
3042
+ // the value forwarded to the proxy; otherwise default to the request URL's host.
3043
+ let hasUserHostHeader = false;
3044
+ for (const name of Object.keys(options.headers)) {
3045
+ if (name.toLowerCase() === 'host') {
3046
+ hasUserHostHeader = true;
3047
+ break;
3048
+ }
3049
+ }
3050
+ if (!hasUserHostHeader) {
3051
+ options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
3052
+ }
3053
+ const proxyHost = readProxyField('hostname') || readProxyField('host');
2860
3054
  options.hostname = proxyHost;
2861
3055
  // Replace 'host' since options is not a URL object
2862
3056
  options.host = proxyHost;
2863
- options.port = proxy.port;
3057
+ options.port = readProxyField('port');
2864
3058
  options.path = location;
2865
- if (proxy.protocol) {
2866
- options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;
3059
+ const proxyProtocol = readProxyField('protocol');
3060
+ if (proxyProtocol) {
3061
+ options.protocol = proxyProtocol.includes(':') ? proxyProtocol : `${proxyProtocol}:`;
2867
3062
  }
2868
3063
  }
2869
3064
  options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
2870
3065
  // Configure proxy for redirected request, passing the original config proxy to apply
2871
3066
  // the exact same logic as if the redirected request was performed by axios directly.
2872
- setProxy(redirectOptions, configProxy, redirectOptions.href);
3067
+ setProxy(redirectOptions, configProxy, redirectOptions.href, true);
2873
3068
  };
2874
3069
  }
2875
3070
  const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
@@ -2965,6 +3160,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
2965
3160
  let isDone;
2966
3161
  let rejected = false;
2967
3162
  let req;
3163
+ let connectPhaseTimer;
2968
3164
  httpVersion = +httpVersion;
2969
3165
  if (Number.isNaN(httpVersion)) {
2970
3166
  throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
@@ -2994,8 +3190,23 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
2994
3190
  console.warn('emit error', err);
2995
3191
  }
2996
3192
  }
3193
+ function clearConnectPhaseTimer() {
3194
+ if (connectPhaseTimer) {
3195
+ clearTimeout(connectPhaseTimer);
3196
+ connectPhaseTimer = null;
3197
+ }
3198
+ }
3199
+ function createTimeoutError() {
3200
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3201
+ const transitional = config.transitional || transitionalDefaults;
3202
+ if (config.timeoutErrorMessage) {
3203
+ timeoutErrorMessage = config.timeoutErrorMessage;
3204
+ }
3205
+ return new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, req);
3206
+ }
2997
3207
  abortEmitter.once('abort', reject);
2998
3208
  const onFinished = () => {
3209
+ clearConnectPhaseTimer();
2999
3210
  if (config.cancelToken) {
3000
3211
  config.cancelToken.unsubscribe(abort);
3001
3212
  }
@@ -3012,6 +3223,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3012
3223
  }
3013
3224
  onDone((response, isRejected) => {
3014
3225
  isDone = true;
3226
+ clearConnectPhaseTimer();
3015
3227
  if (isRejected) {
3016
3228
  rejected = true;
3017
3229
  onFinished();
@@ -3105,7 +3317,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3105
3317
  });
3106
3318
  // support for https://www.npmjs.com/package/form-data api
3107
3319
  } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders) && data.getHeaders !== Object.prototype.getHeaders) {
3108
- headers.set(data.getHeaders());
3320
+ setFormDataHeaders$1(headers, data.getHeaders(), own('formDataHeaderPolicy'));
3109
3321
  if (!headers.hasContentLength()) {
3110
3322
  try {
3111
3323
  const knownLength = await util.promisify(data.getLength).call(data);
@@ -3160,8 +3372,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3160
3372
  auth = username + ':' + password;
3161
3373
  }
3162
3374
  if (!auth && parsed.username) {
3163
- const urlUsername = parsed.username;
3164
- const urlPassword = parsed.password;
3375
+ const urlUsername = decodeURIComponentSafe(parsed.username);
3376
+ const urlPassword = decodeURIComponentSafe(parsed.password);
3165
3377
  auth = urlUsername + ':' + urlPassword;
3166
3378
  }
3167
3379
  auth && headers.delete('authorization');
@@ -3179,7 +3391,6 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3179
3391
 
3180
3392
  // Null-prototype to block prototype pollution gadgets on properties read
3181
3393
  // directly by Node's http.request (e.g. insecureHTTPParser, lookup).
3182
- // See GHSA-q8qp-cvcw-x6jj.
3183
3394
  const options = Object.assign(Object.create(null), {
3184
3395
  path: path$1,
3185
3396
  method: method,
@@ -3217,6 +3428,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3217
3428
  setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
3218
3429
  }
3219
3430
  let transport;
3431
+ let isNativeTransport = false;
3220
3432
  const isHttpsRequest = isHttps.test(options.protocol);
3221
3433
  options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
3222
3434
  if (isHttp2) {
@@ -3227,6 +3439,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3227
3439
  transport = configTransport;
3228
3440
  } else if (config.maxRedirects === 0) {
3229
3441
  transport = isHttpsRequest ? https : http;
3442
+ isNativeTransport = true;
3230
3443
  } else {
3231
3444
  if (config.maxRedirects) {
3232
3445
  options.maxRedirects = config.maxRedirects;
@@ -3247,11 +3460,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3247
3460
 
3248
3461
  // Always set an explicit own value so a polluted
3249
3462
  // Object.prototype.insecureHTTPParser cannot enable the lenient parser
3250
- // through Node's internal options copy (GHSA-q8qp-cvcw-x6jj).
3463
+ // through Node's internal options copy
3251
3464
  options.insecureHTTPParser = Boolean(own('insecureHTTPParser'));
3252
3465
 
3253
3466
  // Create the request
3254
3467
  req = transport.request(options, function handleResponse(res) {
3468
+ clearConnectPhaseTimer();
3255
3469
  if (req.destroyed) return;
3256
3470
  const streams = [res];
3257
3471
  const responseLength = utils$1.toFiniteNumber(res.headers['content-length']);
@@ -3314,7 +3528,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3314
3528
  };
3315
3529
  if (responseType === 'stream') {
3316
3530
  // Enforce maxContentLength on streamed responses; previously this
3317
- // was applied only to buffered responses. See GHSA-vf2m-468p-8v99.
3531
+ // was applied only to buffered responses.
3318
3532
  if (config.maxContentLength > -1) {
3319
3533
  const limit = config.maxContentLength;
3320
3534
  const source = responseStream;
@@ -3353,13 +3567,13 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3353
3567
  if (rejected) {
3354
3568
  return;
3355
3569
  }
3356
- const err = new AxiosError('stream has been aborted', AxiosError.ERR_BAD_RESPONSE, config, lastRequest);
3570
+ const err = new AxiosError('stream has been aborted', AxiosError.ERR_BAD_RESPONSE, config, lastRequest, response);
3357
3571
  responseStream.destroy(err);
3358
3572
  reject(err);
3359
3573
  });
3360
3574
  responseStream.on('error', function handleStreamError(err) {
3361
- if (req.destroyed) return;
3362
- reject(AxiosError.from(err, null, config, lastRequest));
3575
+ if (rejected) return;
3576
+ reject(AxiosError.from(err, null, config, lastRequest, response));
3363
3577
  });
3364
3578
  responseStream.on('end', function handleStreamEnd() {
3365
3579
  try {
@@ -3398,6 +3612,15 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3398
3612
  });
3399
3613
 
3400
3614
  // set tcp keep alive to prevent drop connection by peer
3615
+ // Track every socket bound to this outer RedirectableRequest so a single
3616
+ // 'close' listener can release ownership on all of them. follow-redirects
3617
+ // re-emits the 'socket' event for each hop's native request onto the same
3618
+ // outer request, so attaching per-request listeners inside this handler
3619
+ // would accumulate across hops and trigger MaxListenersExceededWarning at
3620
+ // >= 11 redirects. Clearing only the last-bound socket would leave stale
3621
+ // kAxiosCurrentReq refs on earlier hop sockets returned to the keep-alive
3622
+ // pool, causing an idle-pool 'error' to be attributed to a closed req.
3623
+ const boundSockets = new Set();
3401
3624
  req.on('socket', function handleRequestSocket(socket) {
3402
3625
  // default interval of sending ack packet is 1 minute
3403
3626
  socket.setKeepAlive(true, 1000 * 60);
@@ -3417,11 +3640,16 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3417
3640
  socket[kAxiosSocketListener] = true;
3418
3641
  }
3419
3642
  socket[kAxiosCurrentReq] = req;
3420
- req.once('close', function clearCurrentReq() {
3643
+ boundSockets.add(socket);
3644
+ });
3645
+ req.once('close', function clearCurrentReq() {
3646
+ clearConnectPhaseTimer();
3647
+ for (const socket of boundSockets) {
3421
3648
  if (socket[kAxiosCurrentReq] === req) {
3422
3649
  socket[kAxiosCurrentReq] = null;
3423
3650
  }
3424
- });
3651
+ }
3652
+ boundSockets.clear();
3425
3653
  });
3426
3654
 
3427
3655
  // Handle request timeout
@@ -3432,21 +3660,23 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3432
3660
  abort(new AxiosError('error trying to parse `config.timeout` to int', AxiosError.ERR_BAD_OPTION_VALUE, config, req));
3433
3661
  return;
3434
3662
  }
3663
+ const handleTimeout = function handleTimeout() {
3664
+ if (isDone) return;
3665
+ abort(createTimeoutError());
3666
+ };
3667
+ if (isNativeTransport && timeout > 0) {
3668
+ // Native ClientRequest#setTimeout starts from the socket lifecycle and
3669
+ // may not fire while TCP connect is still pending. Mirror the
3670
+ // follow-redirects wall-clock timer for the maxRedirects === 0 path.
3671
+ connectPhaseTimer = setTimeout(handleTimeout, timeout);
3672
+ }
3435
3673
 
3436
3674
  // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
3437
3675
  // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
3438
3676
  // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
3439
3677
  // And then these socket which be hang up will devouring CPU little by little.
3440
3678
  // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
3441
- req.setTimeout(timeout, function handleRequestTimeout() {
3442
- if (isDone) return;
3443
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3444
- const transitional = config.transitional || transitionalDefaults;
3445
- if (config.timeoutErrorMessage) {
3446
- timeoutErrorMessage = config.timeoutErrorMessage;
3447
- }
3448
- abort(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, req));
3449
- });
3679
+ req.setTimeout(timeout, handleTimeout);
3450
3680
  } else {
3451
3681
  // explicitly reset the socket timeout value for a possible `keep-alive` request
3452
3682
  req.setTimeout(0);
@@ -3471,7 +3701,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3471
3701
 
3472
3702
  // Enforce maxBodyLength for streamed uploads on the native http/https
3473
3703
  // transport (maxRedirects === 0); follow-redirects enforces it on the
3474
- // other path. See GHSA-5c9x-8gcm-mpgx.
3704
+ // other path.
3475
3705
  let uploadStream = data;
3476
3706
  if (config.maxBodyLength > -1 && config.maxRedirects === 0) {
3477
3707
  const limit = config.maxBodyLength;
@@ -3527,8 +3757,20 @@ var cookies = platform.hasStandardBrowserEnv ?
3527
3757
  },
3528
3758
  read(name) {
3529
3759
  if (typeof document === 'undefined') return null;
3530
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
3531
- return match ? decodeURIComponent(match[1]) : null;
3760
+ // Match name=value by splitting on the semicolon separator instead of building a
3761
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
3762
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
3763
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
3764
+ // "; ", so ignore optional whitespace before each cookie name.
3765
+ const cookies = document.cookie.split(';');
3766
+ for (let i = 0; i < cookies.length; i++) {
3767
+ const cookie = cookies[i].replace(/^\s+/, '');
3768
+ const eq = cookie.indexOf('=');
3769
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
3770
+ return decodeURIComponent(cookie.slice(eq + 1));
3771
+ }
3772
+ }
3773
+ return null;
3532
3774
  },
3533
3775
  remove(name) {
3534
3776
  this.write(name, '', Date.now() - 86400000, '/');
@@ -3561,11 +3803,14 @@ function mergeConfig(config1, config2) {
3561
3803
  config2 = config2 || {};
3562
3804
 
3563
3805
  // Use a null-prototype object so that downstream reads such as `config.auth`
3564
- // or `config.baseURL` cannot inherit polluted values from Object.prototype
3565
- // (see GHSA-q8qp-cvcw-x6jj). `hasOwnProperty` is restored as a non-enumerable
3566
- // own slot to preserve ergonomics for user code that relies on it.
3806
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
3807
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
3808
+ // ergonomics for user code that relies on it.
3567
3809
  const config = Object.create(null);
3568
3810
  Object.defineProperty(config, 'hasOwnProperty', {
3811
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
3812
+ // this data descriptor into an accessor descriptor on the way in.
3813
+ __proto__: null,
3569
3814
  value: Object.prototype.hasOwnProperty,
3570
3815
  enumerable: false,
3571
3816
  writable: true,
@@ -3661,11 +3906,33 @@ function mergeConfig(config1, config2) {
3661
3906
  return config;
3662
3907
  }
3663
3908
 
3909
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
3910
+ function setFormDataHeaders(headers, formHeaders, policy) {
3911
+ if (policy !== 'content-only') {
3912
+ headers.set(formHeaders);
3913
+ return;
3914
+ }
3915
+ Object.entries(formHeaders).forEach(([key, val]) => {
3916
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
3917
+ headers.set(key, val);
3918
+ }
3919
+ });
3920
+ }
3921
+
3922
+ /**
3923
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3924
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3925
+ *
3926
+ * @param {string} str The string to encode
3927
+ *
3928
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3929
+ */
3930
+ const encodeUTF8 = str => encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
3664
3931
  var resolveConfig = config => {
3665
3932
  const newConfig = mergeConfig({}, config);
3666
3933
 
3667
3934
  // Read only own properties to prevent prototype pollution gadgets
3668
- // (e.g. Object.prototype.baseURL = 'https://evil.com'). See GHSA-q8qp-cvcw-x6jj.
3935
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
3669
3936
  const own = key => utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined;
3670
3937
  const data = own('data');
3671
3938
  let withXSRFToken = own('withXSRFToken');
@@ -3681,21 +3948,14 @@ var resolveConfig = config => {
3681
3948
 
3682
3949
  // HTTP basic authentication
3683
3950
  if (auth) {
3684
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
3951
+ headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : '')));
3685
3952
  }
3686
3953
  if (utils$1.isFormData(data)) {
3687
3954
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3688
3955
  headers.setContentType(undefined); // browser handles it
3689
3956
  } else if (utils$1.isFunction(data.getHeaders)) {
3690
3957
  // Node.js FormData (like form-data package)
3691
- const formHeaders = data.getHeaders();
3692
- // Only set safe headers to avoid overwriting security headers
3693
- const allowedHeaders = ['content-type', 'content-length'];
3694
- Object.entries(formHeaders).forEach(([key, val]) => {
3695
- if (allowedHeaders.includes(key.toLowerCase())) {
3696
- headers.set(key, val);
3697
- }
3698
- });
3958
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
3699
3959
  }
3700
3960
  }
3701
3961
 
@@ -3710,7 +3970,7 @@ var resolveConfig = config => {
3710
3970
 
3711
3971
  // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
3712
3972
  // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
3713
- // the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
3973
+ // the XSRF token cross-origin.
3714
3974
  const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
3715
3975
  if (shouldSendXSRF) {
3716
3976
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
@@ -3788,7 +4048,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3788
4048
  // handled by onerror instead
3789
4049
  // With one exception: request that using file: protocol, most browsers
3790
4050
  // will return status as 0 even though it's a successful request
3791
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
4051
+ if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith('file:'))) {
3792
4052
  return;
3793
4053
  }
3794
4054
  // readystate handler is calling before onerror or ontimeout handlers,
@@ -3803,6 +4063,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3803
4063
  return;
3804
4064
  }
3805
4065
  reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
4066
+ done();
3806
4067
 
3807
4068
  // Clean up request
3808
4069
  request = null;
@@ -3818,6 +4079,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3818
4079
  // attach the underlying event for consumers who want details
3819
4080
  err.event = event || null;
3820
4081
  reject(err);
4082
+ done();
3821
4083
  request = null;
3822
4084
  };
3823
4085
 
@@ -3829,6 +4091,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3829
4091
  timeoutErrorMessage = _config.timeoutErrorMessage;
3830
4092
  }
3831
4093
  reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
4094
+ done();
3832
4095
 
3833
4096
  // Clean up request
3834
4097
  request = null;
@@ -3875,6 +4138,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3875
4138
  }
3876
4139
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3877
4140
  request.abort();
4141
+ done();
3878
4142
  request = null;
3879
4143
  };
3880
4144
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
@@ -3883,7 +4147,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
3883
4147
  }
3884
4148
  }
3885
4149
  const protocol = parseProtocol(_config.url);
3886
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
4150
+ if (protocol && !platform.protocols.includes(protocol)) {
3887
4151
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3888
4152
  return;
3889
4153
  }
@@ -4017,17 +4281,6 @@ const DEFAULT_CHUNK_SIZE = 64 * 1024;
4017
4281
  const {
4018
4282
  isFunction
4019
4283
  } = utils$1;
4020
- const globalFetchAPI = (({
4021
- Request,
4022
- Response
4023
- }) => ({
4024
- Request,
4025
- Response
4026
- }))(utils$1.global);
4027
- const {
4028
- ReadableStream: ReadableStream$1,
4029
- TextEncoder: TextEncoder$1
4030
- } = utils$1.global;
4031
4284
  const test = (fn, ...args) => {
4032
4285
  try {
4033
4286
  return !!fn(...args);
@@ -4036,9 +4289,18 @@ const test = (fn, ...args) => {
4036
4289
  }
4037
4290
  };
4038
4291
  const factory = env => {
4292
+ var _utils$global;
4293
+ const globalObject = (_utils$global = utils$1.global) !== null && _utils$global !== void 0 ? _utils$global : globalThis;
4294
+ const {
4295
+ ReadableStream,
4296
+ TextEncoder
4297
+ } = globalObject;
4039
4298
  env = utils$1.merge.call({
4040
4299
  skipUndefined: true
4041
- }, globalFetchAPI, env);
4300
+ }, {
4301
+ Request: globalObject.Request,
4302
+ Response: globalObject.Response
4303
+ }, env);
4042
4304
  const {
4043
4305
  fetch: envFetch,
4044
4306
  Request,
@@ -4050,12 +4312,12 @@ const factory = env => {
4050
4312
  if (!isFetchSupported) {
4051
4313
  return false;
4052
4314
  }
4053
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
4054
- const encodeText = isFetchSupported && (typeof TextEncoder$1 === 'function' ? (encoder => str => encoder.encode(str))(new TextEncoder$1()) : async str => new Uint8Array(await new Request(str).arrayBuffer()));
4315
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
4316
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? (encoder => str => encoder.encode(str))(new TextEncoder()) : async str => new Uint8Array(await new Request(str).arrayBuffer()));
4055
4317
  const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
4056
4318
  let duplexAccessed = false;
4057
4319
  const request = new Request(platform.origin, {
4058
- body: new ReadableStream$1(),
4320
+ body: new ReadableStream(),
4059
4321
  method: 'POST',
4060
4322
  get duplex() {
4061
4323
  duplexAccessed = true;
@@ -4124,8 +4386,12 @@ const factory = env => {
4124
4386
  responseType,
4125
4387
  headers,
4126
4388
  withCredentials = 'same-origin',
4127
- fetchOptions
4389
+ fetchOptions,
4390
+ maxContentLength,
4391
+ maxBodyLength
4128
4392
  } = resolveConfig(config);
4393
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
4394
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
4129
4395
  let _fetch = envFetch || fetch;
4130
4396
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
4131
4397
  let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
@@ -4135,6 +4401,26 @@ const factory = env => {
4135
4401
  });
4136
4402
  let requestContentLength;
4137
4403
  try {
4404
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
4405
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
4406
+ // "if (protocol === 'data:')" branch).
4407
+ if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
4408
+ const estimated = estimateDataURLDecodedBytes(url);
4409
+ if (estimated > maxContentLength) {
4410
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4411
+ }
4412
+ }
4413
+
4414
+ // Enforce maxBodyLength against the outbound request body before dispatch.
4415
+ // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
4416
+ // maxBodyLength limit'). Skip when the body length cannot be determined
4417
+ // (e.g. a live ReadableStream supplied by the caller).
4418
+ if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
4419
+ const outboundLength = await resolveBodyLength(headers, data);
4420
+ if (typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength) {
4421
+ throw new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
4422
+ }
4423
+ }
4138
4424
  if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
4139
4425
  let _request = new Request(url, {
4140
4426
  method: 'POST',
@@ -4166,6 +4452,9 @@ const factory = env => {
4166
4452
  headers.delete('content-type');
4167
4453
  }
4168
4454
  }
4455
+
4456
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
4457
+ headers.set('User-Agent', 'axios/' + VERSION, false);
4169
4458
  const resolvedOptions = {
4170
4459
  ...fetchOptions,
4171
4460
  signal: composedSignal,
@@ -4177,21 +4466,59 @@ const factory = env => {
4177
4466
  };
4178
4467
  request = isRequestSupported && new Request(url, resolvedOptions);
4179
4468
  let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
4469
+
4470
+ // Cheap pre-check: if the server honestly declares a content-length that
4471
+ // already exceeds the cap, reject before we start streaming.
4472
+ if (hasMaxContentLength) {
4473
+ const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4474
+ if (declaredLength != null && declaredLength > maxContentLength) {
4475
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4476
+ }
4477
+ }
4180
4478
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
4181
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
4479
+ if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
4182
4480
  const options = {};
4183
4481
  ['status', 'statusText', 'headers'].forEach(prop => {
4184
4482
  options[prop] = response[prop];
4185
4483
  });
4186
4484
  const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4187
4485
  const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
4188
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
4486
+ let bytesRead = 0;
4487
+ const onChunkProgress = loadedBytes => {
4488
+ if (hasMaxContentLength) {
4489
+ bytesRead = loadedBytes;
4490
+ if (bytesRead > maxContentLength) {
4491
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4492
+ }
4493
+ }
4494
+ onProgress && onProgress(loadedBytes);
4495
+ };
4496
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
4189
4497
  flush && flush();
4190
4498
  unsubscribe && unsubscribe();
4191
4499
  }), options);
4192
4500
  }
4193
4501
  responseType = responseType || 'text';
4194
4502
  let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
4503
+
4504
+ // Fallback enforcement for environments without ReadableStream support
4505
+ // (legacy runtimes). Detect materialized size from typed output; skip
4506
+ // streams/Response passthrough since the user will read those themselves.
4507
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
4508
+ let materializedSize;
4509
+ if (responseData != null) {
4510
+ if (typeof responseData.byteLength === 'number') {
4511
+ materializedSize = responseData.byteLength;
4512
+ } else if (typeof responseData.size === 'number') {
4513
+ materializedSize = responseData.size;
4514
+ } else if (typeof responseData === 'string') {
4515
+ materializedSize = typeof TextEncoder === 'function' ? new TextEncoder().encode(responseData).byteLength : responseData.length;
4516
+ }
4517
+ }
4518
+ if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
4519
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4520
+ }
4521
+ }
4195
4522
  !isStreamResponse && unsubscribe && unsubscribe();
4196
4523
  return await new Promise((resolve, reject) => {
4197
4524
  settle(resolve, reject, {
@@ -4205,6 +4532,17 @@ const factory = env => {
4205
4532
  });
4206
4533
  } catch (err) {
4207
4534
  unsubscribe && unsubscribe();
4535
+
4536
+ // Safari can surface fetch aborts as a DOMException-like object whose
4537
+ // branded getters throw. Prefer our composed signal reason before reading
4538
+ // the caught error, preserving timeout vs cancellation semantics.
4539
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
4540
+ const canceledError = composedSignal.reason;
4541
+ canceledError.config = config;
4542
+ request && (canceledError.request = request);
4543
+ err !== canceledError && (canceledError.cause = err);
4544
+ throw canceledError;
4545
+ }
4208
4546
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
4209
4547
  throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response), {
4210
4548
  cause: err.cause || err
@@ -4259,13 +4597,17 @@ const knownAdapters = {
4259
4597
  utils$1.forEach(knownAdapters, (fn, value) => {
4260
4598
  if (fn) {
4261
4599
  try {
4600
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
4601
+ // these data descriptors into accessor descriptors on the way in.
4262
4602
  Object.defineProperty(fn, 'name', {
4603
+ __proto__: null,
4263
4604
  value
4264
4605
  });
4265
4606
  } catch (e) {
4266
4607
  // eslint-disable-next-line no-empty
4267
4608
  }
4268
4609
  Object.defineProperty(fn, 'adapterName', {
4610
+ __proto__: null,
4269
4611
  value
4270
4612
  });
4271
4613
  }
@@ -4380,8 +4722,15 @@ function dispatchRequest(config) {
4380
4722
  return adapter(config).then(function onAdapterResolution(response) {
4381
4723
  throwIfCancellationRequested(config);
4382
4724
 
4383
- // Transform response data
4384
- response.data = transformData.call(config, config.transformResponse, response);
4725
+ // Expose the current response on config so that transformResponse can
4726
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
4727
+ // We clean it up afterwards to avoid polluting the config object.
4728
+ config.response = response;
4729
+ try {
4730
+ response.data = transformData.call(config, config.transformResponse, response);
4731
+ } finally {
4732
+ delete config.response;
4733
+ }
4385
4734
  response.headers = AxiosHeaders.from(response.headers);
4386
4735
  return response;
4387
4736
  }, function onAdapterRejection(reason) {
@@ -4390,7 +4739,12 @@ function dispatchRequest(config) {
4390
4739
 
4391
4740
  // Transform response data
4392
4741
  if (reason && reason.response) {
4393
- reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4742
+ config.response = reason.response;
4743
+ try {
4744
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4745
+ } finally {
4746
+ delete config.response;
4747
+ }
4394
4748
  reason.response.headers = AxiosHeaders.from(reason.response.headers);
4395
4749
  }
4396
4750
  }
@@ -4462,7 +4816,7 @@ function assertOptions(options, schema, allowUnknown) {
4462
4816
  while (i-- > 0) {
4463
4817
  const opt = keys[i];
4464
4818
  // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
4465
- // a non-function validator and cause a TypeError. See GHSA-q8qp-cvcw-x6jj.
4819
+ // a non-function validator and cause a TypeError.
4466
4820
  const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
4467
4821
  if (validator) {
4468
4822
  const value = options[opt];
@@ -4595,7 +4949,7 @@ class Axios {
4595
4949
 
4596
4950
  // Flatten headers
4597
4951
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
4598
- headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], method => {
4952
+ headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], method => {
4599
4953
  delete headers[method];
4600
4954
  });
4601
4955
  config.headers = AxiosHeaders.concat(contextHeaders, headers);
@@ -4676,7 +5030,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
4676
5030
  }));
4677
5031
  };
4678
5032
  });
4679
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
5033
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
4680
5034
  function generateHTTPMethod(isForm) {
4681
5035
  return function httpMethod(url, data, config) {
4682
5036
  return this.request(mergeConfig(config || {}, {
@@ -4690,7 +5044,12 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
4690
5044
  };
4691
5045
  }
4692
5046
  Axios.prototype[method] = generateHTTPMethod();
4693
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
5047
+
5048
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
5049
+ // its semantics, so no queryForm shorthand is generated.
5050
+ if (method !== 'query') {
5051
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
5052
+ }
4694
5053
  });
4695
5054
 
4696
5055
  /**