@mindstone/mcp-server-xero 0.1.3 → 0.1.4

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 (1072) hide show
  1. package/dist/auth/token-grant.js +10 -8
  2. package/dist/bridge-reader.js +35 -78
  3. package/dist/clients/sdk-axios.js +30 -0
  4. package/dist/clients/xero-client.js +14 -8
  5. package/dist/handlers/create-xero-bank-transaction.handler.js +2 -1
  6. package/dist/handlers/create-xero-contact.handler.js +2 -1
  7. package/dist/handlers/create-xero-credit-note.handler.js +2 -1
  8. package/dist/handlers/create-xero-invoice.handler.js +2 -1
  9. package/dist/handlers/create-xero-manual-journal.handler.js +2 -1
  10. package/dist/handlers/create-xero-payment.handler.js +2 -1
  11. package/dist/handlers/create-xero-purchase-order.handler.js +2 -1
  12. package/dist/handlers/create-xero-quote.handler.js +2 -1
  13. package/dist/handlers/create-xero-tracking-category.handler.js +2 -1
  14. package/dist/handlers/history-handler-factory.js +2 -1
  15. package/dist/handlers/list-xero-organisation-details.handler.js +2 -1
  16. package/dist/handlers/list-xero-payroll-employee-leave-balances.handler.js +2 -1
  17. package/dist/handlers/list-xero-payroll-employee-leave-types.handler.js +2 -1
  18. package/dist/handlers/list-xero-payroll-employee-leave.handler.js +2 -1
  19. package/dist/handlers/list-xero-payroll-leave-periods.handler.js +2 -1
  20. package/dist/handlers/list-xero-profit-and-loss.handler.js +1 -1
  21. package/dist/handlers/update-xero-bank-transaction.handler.js +3 -2
  22. package/dist/handlers/update-xero-contact.handler.js +2 -1
  23. package/dist/handlers/update-xero-credit-note.handler.js +2 -1
  24. package/dist/handlers/update-xero-invoice.handler.js +2 -1
  25. package/dist/handlers/update-xero-manual-journal.handler.js +2 -1
  26. package/dist/handlers/update-xero-quote.handler.js +2 -1
  27. package/dist/handlers/update-xero-tracking-category.handler.js +3 -2
  28. package/dist/handlers/update-xero-tracking-options.handler.js +3 -2
  29. package/dist/hardened-json-file.js +91 -0
  30. package/dist/helpers/connector-error.js +11 -0
  31. package/dist/helpers/format-error.js +41 -14
  32. package/dist/helpers/format-token-error.js +4 -0
  33. package/dist/helpers/xero-currencies.js +2 -1
  34. package/dist/tools/sign-in.tool.js +1 -1
  35. package/node_modules/@hono/node-server/README.md +118 -26
  36. package/node_modules/@hono/node-server/dist/conninfo.cjs +22 -0
  37. package/node_modules/@hono/node-server/dist/{conninfo.d.ts → conninfo.d.cts} +4 -3
  38. package/node_modules/@hono/node-server/dist/conninfo.d.mts +4 -3
  39. package/node_modules/@hono/node-server/dist/conninfo.mjs +19 -16
  40. package/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs +5 -0
  41. package/node_modules/@hono/node-server/dist/constants-BXAKTxRC.cjs +11 -0
  42. package/node_modules/@hono/node-server/dist/early-hints.cjs +35 -0
  43. package/node_modules/@hono/node-server/dist/early-hints.d.cts +16 -0
  44. package/node_modules/@hono/node-server/dist/early-hints.d.mts +16 -0
  45. package/node_modules/@hono/node-server/dist/early-hints.mjs +33 -0
  46. package/node_modules/@hono/node-server/dist/index.cjs +1365 -0
  47. package/node_modules/@hono/node-server/dist/index.d.cts +101 -0
  48. package/node_modules/@hono/node-server/dist/index.d.mts +101 -8
  49. package/node_modules/@hono/node-server/dist/index.mjs +1335 -637
  50. package/node_modules/@hono/node-server/dist/serve-static.cjs +153 -0
  51. package/node_modules/@hono/node-server/dist/serve-static.d.cts +19 -0
  52. package/node_modules/@hono/node-server/dist/serve-static.d.mts +15 -13
  53. package/node_modules/@hono/node-server/dist/serve-static.mjs +145 -145
  54. package/node_modules/@hono/node-server/dist/utils/response.cjs +8 -0
  55. package/node_modules/@hono/node-server/dist/utils/response.d.cts +4 -0
  56. package/node_modules/@hono/node-server/dist/utils/response.d.mts +3 -2
  57. package/node_modules/@hono/node-server/dist/utils/response.mjs +6 -9
  58. package/node_modules/@hono/node-server/dist/utils/stream.cjs +65 -0
  59. package/node_modules/@hono/node-server/dist/utils/stream.d.cts +6 -0
  60. package/node_modules/@hono/node-server/dist/utils/stream.d.mts +6 -0
  61. package/node_modules/@hono/node-server/dist/utils/stream.mjs +64 -0
  62. package/node_modules/@hono/node-server/package.json +80 -55
  63. package/node_modules/@modelcontextprotocol/sdk/README.md +8 -2
  64. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts +43 -2
  65. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts.map +1 -1
  66. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js +26 -5
  67. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js.map +1 -1
  68. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts +26 -4
  69. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts.map +1 -1
  70. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js +127 -24
  71. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js.map +1 -1
  72. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.d.ts.map +1 -1
  73. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js +1 -12
  74. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js.map +1 -1
  75. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts +13 -0
  76. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts.map +1 -1
  77. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js +17 -4
  78. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js.map +1 -1
  79. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts +7 -0
  80. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts.map +1 -1
  81. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js +9 -3
  82. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js.map +1 -1
  83. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts +13 -0
  84. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts.map +1 -1
  85. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js +28 -13
  86. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js.map +1 -1
  87. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts +1 -0
  88. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts.map +1 -1
  89. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js +11 -2
  90. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js.map +1 -1
  91. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
  92. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  93. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js +63 -20
  94. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js.map +1 -1
  95. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js +71 -29
  96. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js.map +1 -1
  97. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js +45 -6
  98. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  99. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js +71 -31
  100. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
  101. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js +61 -18
  102. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js.map +1 -1
  103. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
  104. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  105. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js +64 -17
  106. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js.map +1 -1
  107. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
  108. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
  109. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts +4 -0
  110. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts.map +1 -1
  111. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.js.map +1 -1
  112. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts +17 -8
  113. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts.map +1 -1
  114. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js +31 -14
  115. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js.map +1 -1
  116. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts +9 -1
  117. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  118. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js +17 -1
  119. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -1
  120. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.d.ts.map +1 -1
  121. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js +6 -3
  122. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js.map +1 -1
  123. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.d.ts.map +1 -1
  124. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.js +3 -1
  125. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.js.map +1 -1
  126. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.d.ts.map +1 -1
  127. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js +1 -12
  128. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js.map +1 -1
  129. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts +12 -1
  130. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts.map +1 -1
  131. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js +56 -2
  132. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js.map +1 -1
  133. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.d.ts +25 -0
  134. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.d.ts.map +1 -0
  135. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.js +64 -0
  136. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.js.map +1 -0
  137. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts +5 -0
  138. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts.map +1 -0
  139. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js +17 -0
  140. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js.map +1 -0
  141. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts +9 -1
  142. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map +1 -1
  143. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js +10 -4
  144. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map +1 -1
  145. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts +31 -1
  146. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -1
  147. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js +252 -42
  148. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map +1 -1
  149. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map +1 -1
  150. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js +25 -6
  151. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map +1 -1
  152. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts +3 -0
  153. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts.map +1 -1
  154. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js +12 -2
  155. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js.map +1 -1
  156. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts +32 -0
  157. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts.map +1 -0
  158. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js +64 -0
  159. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js.map +1 -0
  160. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts +1 -0
  161. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts.map +1 -1
  162. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js +39 -9
  163. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js.map +1 -1
  164. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts +5 -0
  165. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts.map +1 -1
  166. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js +10 -1
  167. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js.map +1 -1
  168. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts +18 -8
  169. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts.map +1 -1
  170. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js +77 -0
  171. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js.map +1 -1
  172. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts +43 -2
  173. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts.map +1 -1
  174. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js +26 -5
  175. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js.map +1 -1
  176. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts +26 -4
  177. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts.map +1 -1
  178. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +127 -24
  179. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -1
  180. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.d.ts.map +1 -1
  181. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +2 -13
  182. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -1
  183. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts +13 -0
  184. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts.map +1 -1
  185. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js +18 -5
  186. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js.map +1 -1
  187. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts +7 -0
  188. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts.map +1 -1
  189. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js +9 -3
  190. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js.map +1 -1
  191. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts +13 -0
  192. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts.map +1 -1
  193. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +29 -14
  194. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
  195. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts +1 -0
  196. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts.map +1 -1
  197. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js +11 -2
  198. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js.map +1 -1
  199. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
  200. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  201. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js +63 -20
  202. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js.map +1 -1
  203. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js +71 -29
  204. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js.map +1 -1
  205. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js +45 -6
  206. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  207. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js +71 -31
  208. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
  209. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js +61 -18
  210. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js.map +1 -1
  211. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
  212. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  213. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js +64 -17
  214. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js.map +1 -1
  215. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
  216. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
  217. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts +4 -0
  218. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map +1 -1
  219. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -1
  220. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts +17 -8
  221. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map +1 -1
  222. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js +31 -14
  223. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map +1 -1
  224. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts +9 -1
  225. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  226. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js +17 -1
  227. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
  228. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts.map +1 -1
  229. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js +6 -3
  230. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js.map +1 -1
  231. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts.map +1 -1
  232. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js +3 -1
  233. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js.map +1 -1
  234. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map +1 -1
  235. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +2 -13
  236. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -1
  237. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts +12 -1
  238. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map +1 -1
  239. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +56 -2
  240. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -1
  241. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.d.ts +25 -0
  242. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.d.ts.map +1 -0
  243. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js +58 -0
  244. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js.map +1 -0
  245. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts +5 -0
  246. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map +1 -0
  247. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
  248. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map +1 -0
  249. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts +9 -1
  250. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map +1 -1
  251. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +10 -4
  252. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -1
  253. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts +31 -1
  254. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map +1 -1
  255. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +252 -42
  256. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map +1 -1
  257. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map +1 -1
  258. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +25 -6
  259. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -1
  260. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts +3 -0
  261. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts.map +1 -1
  262. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +12 -2
  263. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -1
  264. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts +32 -0
  265. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map +1 -0
  266. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
  267. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map +1 -0
  268. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts +1 -0
  269. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts.map +1 -1
  270. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +39 -9
  271. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -1
  272. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts +5 -0
  273. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map +1 -1
  274. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +9 -0
  275. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -1
  276. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts +18 -8
  277. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map +1 -1
  278. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js +72 -0
  279. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map +1 -1
  280. package/node_modules/@modelcontextprotocol/sdk/package.json +4 -3
  281. package/node_modules/axios/CHANGELOG.md +214 -1
  282. package/node_modules/axios/README.md +471 -82
  283. package/node_modules/axios/dist/axios.js +2009 -516
  284. package/node_modules/axios/dist/axios.min.js +3 -3
  285. package/node_modules/axios/dist/axios.min.js.map +1 -1
  286. package/node_modules/axios/dist/browser/axios.cjs +2174 -487
  287. package/node_modules/axios/dist/esm/axios.js +2174 -487
  288. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  289. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  290. package/node_modules/axios/dist/node/axios.cjs +2410 -515
  291. package/node_modules/axios/index.d.cts +150 -75
  292. package/node_modules/axios/index.d.ts +144 -69
  293. package/node_modules/axios/lib/adapters/adapters.js +1 -1
  294. package/node_modules/axios/lib/adapters/fetch.js +272 -75
  295. package/node_modules/axios/lib/adapters/http.js +475 -122
  296. package/node_modules/axios/lib/adapters/xhr.js +173 -16
  297. package/node_modules/axios/lib/core/Axios.js +114 -35
  298. package/node_modules/axios/lib/core/AxiosError.js +105 -3
  299. package/node_modules/axios/lib/core/AxiosHeaders.js +151 -12
  300. package/node_modules/axios/lib/core/InterceptorManager.js +118 -8
  301. package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
  302. package/node_modules/axios/lib/core/buildFullPath.js +55 -1
  303. package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
  304. package/node_modules/axios/lib/core/dispatchRequest.js +45 -2
  305. package/node_modules/axios/lib/core/mergeConfig.js +203 -90
  306. package/node_modules/axios/lib/core/methodList.js +17 -0
  307. package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  308. package/node_modules/axios/lib/defaults/index.js +2 -1
  309. package/node_modules/axios/lib/defaults/transitional.js +2 -0
  310. package/node_modules/axios/lib/env/data.js +1 -1
  311. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
  312. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
  313. package/node_modules/axios/lib/helpers/Http2Sessions.js +4 -1
  314. package/node_modules/axios/lib/helpers/HttpStatusCode.js +12 -1
  315. package/node_modules/axios/lib/helpers/buildURL.js +6 -3
  316. package/node_modules/axios/lib/helpers/combineURLs.js +11 -3
  317. package/node_modules/axios/lib/helpers/composeSignals.js +18 -4
  318. package/node_modules/axios/lib/helpers/cookies.js +30 -2
  319. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +156 -63
  320. package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
  321. package/node_modules/axios/lib/helpers/formDataToJSON.js +60 -8
  322. package/node_modules/axios/lib/helpers/fromDataURI.js +12 -3
  323. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
  324. package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  325. package/node_modules/axios/lib/helpers/parseHeaders.js +7 -4
  326. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  327. package/node_modules/axios/lib/helpers/progressEventReducer.js +4 -4
  328. package/node_modules/axios/lib/helpers/resolveConfig.js +33 -25
  329. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +345 -3
  330. package/node_modules/axios/lib/helpers/throttle.js +3 -2
  331. package/node_modules/axios/lib/helpers/toFormData.js +60 -30
  332. package/node_modules/axios/lib/helpers/validator.js +1 -1
  333. package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  334. package/node_modules/axios/lib/utils.js +271 -23
  335. package/node_modules/axios/package.json +31 -30
  336. package/node_modules/body-parser/README.md +33 -14
  337. package/node_modules/body-parser/index.js +4 -20
  338. package/node_modules/body-parser/lib/read.js +85 -68
  339. package/node_modules/body-parser/lib/types/json.js +67 -39
  340. package/node_modules/body-parser/lib/types/raw.js +3 -3
  341. package/node_modules/body-parser/lib/types/text.js +3 -3
  342. package/node_modules/body-parser/lib/types/urlencoded.js +21 -25
  343. package/node_modules/body-parser/lib/utils.js +14 -27
  344. package/node_modules/body-parser/node_modules/content-type/LICENSE +22 -0
  345. package/node_modules/body-parser/node_modules/content-type/README.md +71 -0
  346. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +46 -0
  347. package/node_modules/body-parser/node_modules/content-type/dist/index.js +176 -0
  348. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -0
  349. package/node_modules/body-parser/node_modules/content-type/package.json +52 -0
  350. package/node_modules/body-parser/package.json +24 -16
  351. package/node_modules/es-object-atoms/CHANGELOG.md +21 -14
  352. package/node_modules/es-object-atoms/isObject.d.ts +1 -1
  353. package/node_modules/es-object-atoms/package.json +6 -7
  354. package/node_modules/es-object-atoms/tsconfig.json +1 -0
  355. package/node_modules/express-rate-limit/dist/index.cjs +90 -12
  356. package/node_modules/express-rate-limit/dist/index.d.cts +27 -0
  357. package/node_modules/express-rate-limit/dist/index.d.mts +27 -0
  358. package/node_modules/express-rate-limit/dist/index.d.ts +27 -0
  359. package/node_modules/express-rate-limit/dist/index.mjs +76 -12
  360. package/node_modules/express-rate-limit/{license.md → license} +7 -6
  361. package/node_modules/express-rate-limit/package.json +19 -16
  362. package/node_modules/express-rate-limit/readme.md +1 -0
  363. package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
  364. package/node_modules/fast-uri/README.md +8 -0
  365. package/node_modules/fast-uri/index.js +355 -50
  366. package/node_modules/fast-uri/lib/schemes.js +9 -4
  367. package/node_modules/fast-uri/lib/utils.js +448 -92
  368. package/node_modules/fast-uri/package.json +1 -1
  369. package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
  370. package/node_modules/fast-uri/test/equal.test.js +31 -3
  371. package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
  372. package/node_modules/fast-uri/test/host-delimiter-security.test.js +94 -0
  373. package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
  374. package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
  375. package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
  376. package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
  377. package/node_modules/fast-uri/test/parse.test.js +7 -3
  378. package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
  379. package/node_modules/fast-uri/test/relative-normalization-security.test.js +156 -0
  380. package/node_modules/fast-uri/test/reserved-path-normalization.test.js +137 -0
  381. package/node_modules/fast-uri/test/scheme-validation.test.js +163 -0
  382. package/node_modules/fast-uri/test/security-normalization.test.js +139 -0
  383. package/node_modules/fast-uri/test/security.test.js +301 -3
  384. package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
  385. package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
  386. package/node_modules/follow-redirects/README.md +27 -1
  387. package/node_modules/follow-redirects/index.js +12 -6
  388. package/node_modules/follow-redirects/package.json +1 -1
  389. package/node_modules/form-data/CHANGELOG.md +29 -2
  390. package/node_modules/form-data/README.md +4 -4
  391. package/node_modules/form-data/lib/form_data.js +14 -2
  392. package/node_modules/form-data/package.json +7 -7
  393. package/node_modules/hasown/CHANGELOG.md +18 -0
  394. package/node_modules/hasown/eslint.config.mjs +6 -0
  395. package/node_modules/hasown/package.json +13 -14
  396. package/node_modules/hono/README.md +2 -3
  397. package/node_modules/hono/dist/_virtual/_rolldown/runtime.js +13 -0
  398. package/node_modules/hono/dist/adapter/aws-lambda/conninfo.js +42 -23
  399. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +320 -351
  400. package/node_modules/hono/dist/adapter/aws-lambda/index.js +2 -8
  401. package/node_modules/hono/dist/adapter/aws-lambda/types.js +1 -0
  402. package/node_modules/hono/dist/adapter/bun/conninfo.js +20 -25
  403. package/node_modules/hono/dist/adapter/bun/index.js +3 -13
  404. package/node_modules/hono/dist/adapter/bun/serve-static.js +27 -27
  405. package/node_modules/hono/dist/adapter/bun/server.js +11 -5
  406. package/node_modules/hono/dist/adapter/bun/ssg.js +25 -15
  407. package/node_modules/hono/dist/adapter/bun/websocket.js +61 -66
  408. package/node_modules/hono/dist/adapter/cloudflare-pages/conninfo.js +24 -9
  409. package/node_modules/hono/dist/adapter/cloudflare-pages/handler.js +59 -62
  410. package/node_modules/hono/dist/adapter/cloudflare-pages/index.js +2 -8
  411. package/node_modules/hono/dist/adapter/cloudflare-workers/conninfo.js +7 -9
  412. package/node_modules/hono/dist/adapter/cloudflare-workers/index.js +3 -8
  413. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js +5 -6
  414. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js +26 -20
  415. package/node_modules/hono/dist/adapter/cloudflare-workers/utils.js +21 -34
  416. package/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js +31 -39
  417. package/node_modules/hono/dist/adapter/deno/conninfo.js +16 -13
  418. package/node_modules/hono/dist/adapter/deno/deno.d.js +1 -0
  419. package/node_modules/hono/dist/adapter/deno/index.js +3 -10
  420. package/node_modules/hono/dist/adapter/deno/serve-static.js +33 -38
  421. package/node_modules/hono/dist/adapter/deno/ssg.js +27 -16
  422. package/node_modules/hono/dist/adapter/deno/websocket.js +30 -30
  423. package/node_modules/hono/dist/adapter/lambda-edge/conninfo.js +7 -9
  424. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +102 -71
  425. package/node_modules/hono/dist/adapter/lambda-edge/index.js +2 -6
  426. package/node_modules/hono/dist/adapter/netlify/conninfo.js +24 -9
  427. package/node_modules/hono/dist/adapter/netlify/handler.js +10 -8
  428. package/node_modules/hono/dist/adapter/netlify/index.js +3 -2
  429. package/node_modules/hono/dist/adapter/netlify/mod.js +2 -6
  430. package/node_modules/hono/dist/adapter/service-worker/handler.js +15 -19
  431. package/node_modules/hono/dist/adapter/service-worker/index.js +23 -7
  432. package/node_modules/hono/dist/adapter/service-worker/types.js +1 -0
  433. package/node_modules/hono/dist/adapter/vercel/conninfo.js +7 -10
  434. package/node_modules/hono/dist/adapter/vercel/handler.js +8 -6
  435. package/node_modules/hono/dist/adapter/vercel/index.js +2 -6
  436. package/node_modules/hono/dist/cjs/_virtual/_rolldown/runtime.js +33 -0
  437. package/node_modules/hono/dist/cjs/adapter/aws-lambda/conninfo.js +42 -44
  438. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +328 -380
  439. package/node_modules/hono/dist/cjs/adapter/aws-lambda/index.js +7 -34
  440. package/node_modules/hono/dist/cjs/adapter/aws-lambda/types.js +0 -15
  441. package/node_modules/hono/dist/cjs/adapter/bun/conninfo.js +21 -47
  442. package/node_modules/hono/dist/cjs/adapter/bun/index.js +14 -45
  443. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +29 -50
  444. package/node_modules/hono/dist/cjs/adapter/bun/server.js +11 -26
  445. package/node_modules/hono/dist/cjs/adapter/bun/ssg.js +24 -35
  446. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +63 -89
  447. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/conninfo.js +25 -31
  448. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/handler.js +61 -85
  449. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/index.js +7 -34
  450. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/conninfo.js +8 -31
  451. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/index.js +7 -33
  452. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static-module.js +7 -29
  453. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static.js +27 -42
  454. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/utils.js +21 -55
  455. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/websocket.js +33 -62
  456. package/node_modules/hono/dist/cjs/adapter/deno/conninfo.js +16 -34
  457. package/node_modules/hono/dist/cjs/adapter/deno/index.js +10 -38
  458. package/node_modules/hono/dist/cjs/adapter/deno/serve-static.js +33 -59
  459. package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +27 -37
  460. package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +32 -53
  461. package/node_modules/hono/dist/cjs/adapter/lambda-edge/conninfo.js +8 -31
  462. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +105 -103
  463. package/node_modules/hono/dist/cjs/adapter/lambda-edge/index.js +5 -30
  464. package/node_modules/hono/dist/cjs/adapter/netlify/conninfo.js +25 -31
  465. package/node_modules/hono/dist/cjs/adapter/netlify/handler.js +10 -29
  466. package/node_modules/hono/dist/cjs/adapter/netlify/index.js +5 -21
  467. package/node_modules/hono/dist/cjs/adapter/netlify/mod.js +5 -30
  468. package/node_modules/hono/dist/cjs/adapter/service-worker/handler.js +16 -41
  469. package/node_modules/hono/dist/cjs/adapter/service-worker/index.js +25 -30
  470. package/node_modules/hono/dist/cjs/adapter/service-worker/types.js +0 -15
  471. package/node_modules/hono/dist/cjs/adapter/vercel/conninfo.js +8 -32
  472. package/node_modules/hono/dist/cjs/adapter/vercel/handler.js +8 -27
  473. package/node_modules/hono/dist/cjs/adapter/vercel/index.js +5 -30
  474. package/node_modules/hono/dist/cjs/client/client.js +140 -190
  475. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +62 -80
  476. package/node_modules/hono/dist/cjs/client/index.js +7 -32
  477. package/node_modules/hono/dist/cjs/client/types.js +0 -15
  478. package/node_modules/hono/dist/cjs/client/utils.js +54 -89
  479. package/node_modules/hono/dist/cjs/compose.js +49 -66
  480. package/node_modules/hono/dist/cjs/context.js +379 -431
  481. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +50 -38
  482. package/node_modules/hono/dist/cjs/helper/accepts/index.js +3 -27
  483. package/node_modules/hono/dist/cjs/helper/adapter/index.js +33 -73
  484. package/node_modules/hono/dist/cjs/helper/conninfo/index.js +0 -15
  485. package/node_modules/hono/dist/cjs/helper/conninfo/types.js +0 -15
  486. package/node_modules/hono/dist/cjs/helper/cookie/index.js +75 -116
  487. package/node_modules/hono/dist/cjs/helper/css/common.js +167 -241
  488. package/node_modules/hono/dist/cjs/helper/css/index.js +136 -143
  489. package/node_modules/hono/dist/cjs/helper/dev/index.js +45 -71
  490. package/node_modules/hono/dist/cjs/helper/factory/index.js +30 -51
  491. package/node_modules/hono/dist/cjs/helper/html/index.js +32 -62
  492. package/node_modules/hono/dist/cjs/helper/proxy/index.js +113 -102
  493. package/node_modules/hono/dist/cjs/helper/route/index.js +125 -66
  494. package/node_modules/hono/dist/cjs/helper/ssg/index.js +19 -43
  495. package/node_modules/hono/dist/cjs/helper/ssg/middleware.js +56 -64
  496. package/node_modules/hono/dist/cjs/helper/ssg/plugins.js +55 -57
  497. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +200 -298
  498. package/node_modules/hono/dist/cjs/helper/ssg/utils.js +53 -76
  499. package/node_modules/hono/dist/cjs/helper/streaming/index.js +8 -35
  500. package/node_modules/hono/dist/cjs/helper/streaming/sse.js +53 -84
  501. package/node_modules/hono/dist/cjs/helper/streaming/stream.js +23 -53
  502. package/node_modules/hono/dist/cjs/helper/streaming/text.js +10 -32
  503. package/node_modules/hono/dist/cjs/helper/streaming/utils.js +13 -32
  504. package/node_modules/hono/dist/cjs/helper/testing/index.js +16 -31
  505. package/node_modules/hono/dist/cjs/helper/websocket/index.js +51 -76
  506. package/node_modules/hono/dist/cjs/hono-base.js +346 -401
  507. package/node_modules/hono/dist/cjs/hono.js +27 -42
  508. package/node_modules/hono/dist/cjs/http-exception.js +55 -56
  509. package/node_modules/hono/dist/cjs/index.js +22 -30
  510. package/node_modules/hono/dist/cjs/jsx/base.js +264 -359
  511. package/node_modules/hono/dist/cjs/jsx/children.js +16 -41
  512. package/node_modules/hono/dist/cjs/jsx/components.js +120 -174
  513. package/node_modules/hono/dist/cjs/jsx/constants.js +17 -42
  514. package/node_modules/hono/dist/cjs/jsx/context.js +166 -58
  515. package/node_modules/hono/dist/cjs/jsx/dom/client.js +49 -69
  516. package/node_modules/hono/dist/cjs/jsx/dom/components.js +23 -52
  517. package/node_modules/hono/dist/cjs/jsx/dom/context.js +39 -67
  518. package/node_modules/hono/dist/cjs/jsx/dom/css.js +143 -158
  519. package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +55 -64
  520. package/node_modules/hono/dist/cjs/jsx/dom/index.js +114 -173
  521. package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +282 -375
  522. package/node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js +14 -49
  523. package/node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js +5 -32
  524. package/node_modules/hono/dist/cjs/jsx/dom/render.js +471 -587
  525. package/node_modules/hono/dist/cjs/jsx/dom/server.js +37 -60
  526. package/node_modules/hono/dist/cjs/jsx/dom/utils.js +7 -30
  527. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +227 -317
  528. package/node_modules/hono/dist/cjs/jsx/index.js +86 -135
  529. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/common.js +20 -43
  530. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +117 -168
  531. package/node_modules/hono/dist/cjs/jsx/intrinsic-elements.js +0 -15
  532. package/node_modules/hono/dist/cjs/jsx/jsx-dev-runtime.js +14 -39
  533. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +29 -67
  534. package/node_modules/hono/dist/cjs/jsx/streaming.js +123 -165
  535. package/node_modules/hono/dist/cjs/jsx/types.js +0 -15
  536. package/node_modules/hono/dist/cjs/jsx/utils.js +91 -175
  537. package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +98 -86
  538. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +100 -109
  539. package/node_modules/hono/dist/cjs/middleware/body-limit/index.js +65 -72
  540. package/node_modules/hono/dist/cjs/middleware/cache/index.js +166 -117
  541. package/node_modules/hono/dist/cjs/middleware/combine/index.js +135 -95
  542. package/node_modules/hono/dist/cjs/middleware/compress/index.js +74 -83
  543. package/node_modules/hono/dist/cjs/middleware/context-storage/index.js +49 -41
  544. package/node_modules/hono/dist/cjs/middleware/cors/index.js +107 -107
  545. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +103 -74
  546. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +58 -51
  547. package/node_modules/hono/dist/cjs/middleware/etag/index.js +73 -87
  548. package/node_modules/hono/dist/cjs/middleware/ip-restriction/index.js +161 -169
  549. package/node_modules/hono/dist/cjs/middleware/jsx-renderer/index.js +99 -77
  550. package/node_modules/hono/dist/cjs/middleware/jwk/index.js +3 -27
  551. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +118 -130
  552. package/node_modules/hono/dist/cjs/middleware/jwt/index.js +9 -38
  553. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +120 -136
  554. package/node_modules/hono/dist/cjs/middleware/language/index.js +7 -35
  555. package/node_modules/hono/dist/cjs/middleware/language/language.js +184 -197
  556. package/node_modules/hono/dist/cjs/middleware/logger/index.js +41 -62
  557. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +84 -0
  558. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +101 -100
  559. package/node_modules/hono/dist/cjs/middleware/mount/index.js +72 -0
  560. package/node_modules/hono/dist/cjs/middleware/powered-by/index.js +23 -30
  561. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +40 -35
  562. package/node_modules/hono/dist/cjs/middleware/request-id/index.js +3 -27
  563. package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +34 -42
  564. package/node_modules/hono/dist/cjs/middleware/secure-headers/index.js +4 -29
  565. package/node_modules/hono/dist/cjs/middleware/secure-headers/permissions-policy.js +0 -15
  566. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +143 -166
  567. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +58 -93
  568. package/node_modules/hono/dist/cjs/middleware/serve-static/path.js +15 -38
  569. package/node_modules/hono/dist/cjs/middleware/timeout/index.js +40 -45
  570. package/node_modules/hono/dist/cjs/middleware/timing/index.js +7 -35
  571. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +178 -116
  572. package/node_modules/hono/dist/cjs/middleware/trailing-slash/index.js +85 -58
  573. package/node_modules/hono/dist/cjs/preset/quick.js +18 -37
  574. package/node_modules/hono/dist/cjs/preset/tiny.js +15 -33
  575. package/node_modules/hono/dist/cjs/request/constants.js +5 -27
  576. package/node_modules/hono/dist/cjs/request.js +334 -336
  577. package/node_modules/hono/dist/cjs/router/linear-router/index.js +3 -27
  578. package/node_modules/hono/dist/cjs/router/linear-router/router.js +95 -138
  579. package/node_modules/hono/dist/cjs/router/pattern-router/index.js +3 -27
  580. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +41 -69
  581. package/node_modules/hono/dist/cjs/router/reg-exp-router/index.js +7 -34
  582. package/node_modules/hono/dist/cjs/router/reg-exp-router/matcher.js +18 -45
  583. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +95 -131
  584. package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +92 -161
  585. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +88 -206
  586. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +83 -80
  587. package/node_modules/hono/dist/cjs/router/smart-router/index.js +3 -27
  588. package/node_modules/hono/dist/cjs/router/smart-router/router.js +49 -79
  589. package/node_modules/hono/dist/cjs/router/trie-router/index.js +3 -27
  590. package/node_modules/hono/dist/cjs/router/trie-router/node.js +134 -200
  591. package/node_modules/hono/dist/cjs/router/trie-router/router.js +15 -47
  592. package/node_modules/hono/dist/cjs/router/utils.js +5 -0
  593. package/node_modules/hono/dist/cjs/router.js +37 -37
  594. package/node_modules/hono/dist/cjs/types.js +5 -28
  595. package/node_modules/hono/dist/cjs/utils/accept.js +177 -228
  596. package/node_modules/hono/dist/cjs/utils/basic-auth.js +16 -40
  597. package/node_modules/hono/dist/cjs/utils/body.js +89 -89
  598. package/node_modules/hono/dist/cjs/utils/buffer.js +43 -90
  599. package/node_modules/hono/dist/cjs/utils/color.js +35 -44
  600. package/node_modules/hono/dist/cjs/utils/compress.js +11 -26
  601. package/node_modules/hono/dist/cjs/utils/concurrent.js +29 -59
  602. package/node_modules/hono/dist/cjs/utils/constants.js +7 -26
  603. package/node_modules/hono/dist/cjs/utils/cookie.js +108 -177
  604. package/node_modules/hono/dist/cjs/utils/crypto.js +30 -61
  605. package/node_modules/hono/dist/cjs/utils/encode.js +31 -48
  606. package/node_modules/hono/dist/cjs/utils/filepath.js +23 -54
  607. package/node_modules/hono/dist/cjs/utils/handler.js +11 -33
  608. package/node_modules/hono/dist/cjs/utils/headers.js +0 -15
  609. package/node_modules/hono/dist/cjs/utils/html.js +96 -137
  610. package/node_modules/hono/dist/cjs/utils/http-status.js +0 -15
  611. package/node_modules/hono/dist/cjs/utils/ipaddr.js +213 -279
  612. package/node_modules/hono/dist/cjs/utils/jwt/index.js +14 -27
  613. package/node_modules/hono/dist/cjs/utils/jwt/jwa.js +25 -42
  614. package/node_modules/hono/dist/cjs/utils/jwt/jws.js +119 -199
  615. package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +123 -205
  616. package/node_modules/hono/dist/cjs/utils/jwt/types.js +122 -159
  617. package/node_modules/hono/dist/cjs/utils/jwt/utf8.js +9 -28
  618. package/node_modules/hono/dist/cjs/utils/mime.js +75 -101
  619. package/node_modules/hono/dist/cjs/utils/mount.js +51 -0
  620. package/node_modules/hono/dist/cjs/utils/stream.js +88 -102
  621. package/node_modules/hono/dist/cjs/utils/types.js +0 -15
  622. package/node_modules/hono/dist/cjs/utils/url.js +199 -228
  623. package/node_modules/hono/dist/cjs/validator/index.js +3 -27
  624. package/node_modules/hono/dist/cjs/validator/utils.js +0 -15
  625. package/node_modules/hono/dist/cjs/validator/validator.js +63 -106
  626. package/node_modules/hono/dist/client/client.js +139 -175
  627. package/node_modules/hono/dist/client/fetch-result-please.js +59 -56
  628. package/node_modules/hono/dist/client/index.js +3 -7
  629. package/node_modules/hono/dist/client/types.js +1 -0
  630. package/node_modules/hono/dist/client/utils.js +51 -65
  631. package/node_modules/hono/dist/compose.js +49 -45
  632. package/node_modules/hono/dist/context.js +376 -407
  633. package/node_modules/hono/dist/helper/accepts/accepts.js +49 -16
  634. package/node_modules/hono/dist/helper/accepts/index.js +1 -4
  635. package/node_modules/hono/dist/helper/adapter/index.js +33 -52
  636. package/node_modules/hono/dist/helper/conninfo/index.js +1 -0
  637. package/node_modules/hono/dist/helper/conninfo/types.js +1 -0
  638. package/node_modules/hono/dist/helper/cookie/index.js +74 -94
  639. package/node_modules/hono/dist/helper/css/common.js +169 -222
  640. package/node_modules/hono/dist/helper/css/index.js +132 -129
  641. package/node_modules/hono/dist/helper/dev/index.js +44 -49
  642. package/node_modules/hono/dist/helper/factory/index.js +27 -27
  643. package/node_modules/hono/dist/helper/html/index.js +30 -39
  644. package/node_modules/hono/dist/helper/proxy/index.js +116 -84
  645. package/node_modules/hono/dist/helper/route/index.js +123 -43
  646. package/node_modules/hono/dist/helper/ssg/index.js +3 -18
  647. package/node_modules/hono/dist/helper/ssg/middleware.js +53 -40
  648. package/node_modules/hono/dist/helper/ssg/plugins.js +55 -36
  649. package/node_modules/hono/dist/helper/ssg/ssg.js +200 -283
  650. package/node_modules/hono/dist/helper/ssg/utils.js +54 -56
  651. package/node_modules/hono/dist/helper/streaming/index.js +2 -8
  652. package/node_modules/hono/dist/helper/streaming/sse.js +50 -60
  653. package/node_modules/hono/dist/helper/streaming/stream.js +22 -31
  654. package/node_modules/hono/dist/helper/streaming/text.js +9 -10
  655. package/node_modules/hono/dist/helper/streaming/utils.js +9 -12
  656. package/node_modules/hono/dist/helper/testing/index.js +16 -10
  657. package/node_modules/hono/dist/helper/websocket/index.js +49 -53
  658. package/node_modules/hono/dist/hono-base.js +343 -377
  659. package/node_modules/hono/dist/hono.js +26 -20
  660. package/node_modules/hono/dist/http-exception.js +53 -33
  661. package/node_modules/hono/dist/index.js +19 -6
  662. package/node_modules/hono/dist/jsx/base.js +252 -326
  663. package/node_modules/hono/dist/jsx/children.js +16 -20
  664. package/node_modules/hono/dist/jsx/components.js +119 -152
  665. package/node_modules/hono/dist/jsx/constants.js +10 -15
  666. package/node_modules/hono/dist/jsx/context.js +162 -35
  667. package/node_modules/hono/dist/jsx/dom/client.js +45 -48
  668. package/node_modules/hono/dist/jsx/dom/components.js +21 -29
  669. package/node_modules/hono/dist/jsx/dom/context.js +37 -44
  670. package/node_modules/hono/dist/jsx/dom/css.js +142 -147
  671. package/node_modules/hono/dist/jsx/dom/hooks/index.js +52 -40
  672. package/node_modules/hono/dist/jsx/dom/index.js +71 -134
  673. package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +275 -359
  674. package/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js +14 -18
  675. package/node_modules/hono/dist/jsx/dom/jsx-runtime.js +2 -8
  676. package/node_modules/hono/dist/jsx/dom/render.js +492 -593
  677. package/node_modules/hono/dist/jsx/dom/server.js +33 -29
  678. package/node_modules/hono/dist/jsx/dom/utils.js +6 -8
  679. package/node_modules/hono/dist/jsx/hooks/index.js +238 -307
  680. package/node_modules/hono/dist/jsx/index.js +45 -98
  681. package/node_modules/hono/dist/jsx/intrinsic-element/common.js +20 -22
  682. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +113 -154
  683. package/node_modules/hono/dist/jsx/intrinsic-elements.js +1 -0
  684. package/node_modules/hono/dist/jsx/jsx-dev-runtime.js +12 -16
  685. package/node_modules/hono/dist/jsx/jsx-runtime.js +25 -42
  686. package/node_modules/hono/dist/jsx/streaming.js +121 -142
  687. package/node_modules/hono/dist/jsx/types.js +1 -0
  688. package/node_modules/hono/dist/jsx/utils.js +105 -168
  689. package/node_modules/hono/dist/middleware/basic-auth/index.js +96 -63
  690. package/node_modules/hono/dist/middleware/bearer-auth/index.js +101 -89
  691. package/node_modules/hono/dist/middleware/body-limit/index.js +65 -51
  692. package/node_modules/hono/dist/middleware/cache/index.js +169 -99
  693. package/node_modules/hono/dist/middleware/combine/index.js +134 -73
  694. package/node_modules/hono/dist/middleware/compress/index.js +75 -63
  695. package/node_modules/hono/dist/middleware/context-storage/index.js +49 -19
  696. package/node_modules/hono/dist/middleware/cors/index.js +107 -86
  697. package/node_modules/hono/dist/middleware/csrf/index.js +103 -53
  698. package/node_modules/hono/dist/middleware/etag/digest.js +59 -31
  699. package/node_modules/hono/dist/middleware/etag/index.js +73 -66
  700. package/node_modules/hono/dist/middleware/ip-restriction/index.js +163 -158
  701. package/node_modules/hono/dist/middleware/jsx-renderer/index.js +97 -54
  702. package/node_modules/hono/dist/middleware/jwk/index.js +1 -4
  703. package/node_modules/hono/dist/middleware/jwk/jwk.js +116 -107
  704. package/node_modules/hono/dist/middleware/jwt/index.js +2 -10
  705. package/node_modules/hono/dist/middleware/jwt/jwt.js +114 -109
  706. package/node_modules/hono/dist/middleware/language/index.js +2 -15
  707. package/node_modules/hono/dist/middleware/language/language.js +180 -172
  708. package/node_modules/hono/dist/middleware/logger/index.js +43 -37
  709. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +83 -0
  710. package/node_modules/hono/dist/middleware/method-override/index.js +101 -79
  711. package/node_modules/hono/dist/middleware/mount/index.js +71 -0
  712. package/node_modules/hono/dist/middleware/powered-by/index.js +23 -9
  713. package/node_modules/hono/dist/middleware/pretty-json/index.js +40 -14
  714. package/node_modules/hono/dist/middleware/request-id/index.js +1 -4
  715. package/node_modules/hono/dist/middleware/request-id/request-id.js +33 -20
  716. package/node_modules/hono/dist/middleware/secure-headers/index.js +1 -5
  717. package/node_modules/hono/dist/middleware/secure-headers/permissions-policy.js +1 -0
  718. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +145 -147
  719. package/node_modules/hono/dist/middleware/serve-static/index.js +58 -72
  720. package/node_modules/hono/dist/middleware/serve-static/path.js +15 -17
  721. package/node_modules/hono/dist/middleware/timeout/index.js +40 -23
  722. package/node_modules/hono/dist/middleware/timing/index.js +2 -9
  723. package/node_modules/hono/dist/middleware/timing/timing.js +178 -95
  724. package/node_modules/hono/dist/middleware/trailing-slash/index.js +85 -37
  725. package/node_modules/hono/dist/preset/quick.js +17 -15
  726. package/node_modules/hono/dist/preset/tiny.js +14 -11
  727. package/node_modules/hono/dist/request/constants.js +4 -5
  728. package/node_modules/hono/dist/request.js +329 -310
  729. package/node_modules/hono/dist/router/linear-router/index.js +1 -4
  730. package/node_modules/hono/dist/router/linear-router/router.js +93 -115
  731. package/node_modules/hono/dist/router/pattern-router/index.js +1 -4
  732. package/node_modules/hono/dist/router/pattern-router/router.js +39 -46
  733. package/node_modules/hono/dist/router/reg-exp-router/index.js +1 -7
  734. package/node_modules/hono/dist/router/reg-exp-router/matcher.js +17 -23
  735. package/node_modules/hono/dist/router/reg-exp-router/node.js +90 -108
  736. package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +89 -137
  737. package/node_modules/hono/dist/router/reg-exp-router/router.js +82 -183
  738. package/node_modules/hono/dist/router/reg-exp-router/trie.js +80 -56
  739. package/node_modules/hono/dist/router/smart-router/index.js +1 -4
  740. package/node_modules/hono/dist/router/smart-router/router.js +46 -55
  741. package/node_modules/hono/dist/router/trie-router/index.js +1 -4
  742. package/node_modules/hono/dist/router/trie-router/node.js +132 -177
  743. package/node_modules/hono/dist/router/trie-router/router.js +11 -22
  744. package/node_modules/hono/dist/router/utils.js +4 -0
  745. package/node_modules/hono/dist/router.js +35 -14
  746. package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +4 -1
  747. package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +150 -104
  748. package/node_modules/hono/dist/types/adapter/aws-lambda/index.d.ts +4 -8
  749. package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +152 -113
  750. package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +4 -1
  751. package/node_modules/hono/dist/types/adapter/bun/index.d.ts +6 -10
  752. package/node_modules/hono/dist/types/adapter/bun/serve-static.d.ts +7 -2
  753. package/node_modules/hono/dist/types/adapter/bun/server.d.ts +4 -5
  754. package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +5 -1
  755. package/node_modules/hono/dist/types/adapter/bun/websocket.d.ts +31 -16
  756. package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +4 -1
  757. package/node_modules/hono/dist/types/adapter/cloudflare-pages/handler.d.ts +29 -17
  758. package/node_modules/hono/dist/types/adapter/cloudflare-pages/index.d.ts +3 -7
  759. package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +6 -1
  760. package/node_modules/hono/dist/types/adapter/cloudflare-workers/index.d.ts +4 -7
  761. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +5 -2
  762. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static.d.ts +10 -5
  763. package/node_modules/hono/dist/types/adapter/cloudflare-workers/utils.d.ts +10 -2
  764. package/node_modules/hono/dist/types/adapter/cloudflare-workers/websocket.d.ts +6 -1
  765. package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +4 -1
  766. package/node_modules/hono/dist/types/adapter/deno/deno.d.ts +1 -0
  767. package/node_modules/hono/dist/types/adapter/deno/index.d.ts +5 -8
  768. package/node_modules/hono/dist/types/adapter/deno/serve-static.d.ts +7 -2
  769. package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +5 -1
  770. package/node_modules/hono/dist/types/adapter/deno/websocket.d.ts +6 -1
  771. package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +6 -1
  772. package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +84 -58
  773. package/node_modules/hono/dist/types/adapter/lambda-edge/index.d.ts +3 -7
  774. package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +4 -1
  775. package/node_modules/hono/dist/types/adapter/netlify/handler.d.ts +6 -1
  776. package/node_modules/hono/dist/types/adapter/netlify/index.d.ts +3 -5
  777. package/node_modules/hono/dist/types/adapter/netlify/mod.d.ts +3 -2
  778. package/node_modules/hono/dist/types/adapter/service-worker/handler.d.ts +9 -7
  779. package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +7 -9
  780. package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +12 -7
  781. package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +6 -1
  782. package/node_modules/hono/dist/types/adapter/vercel/handler.d.ts +6 -1
  783. package/node_modules/hono/dist/types/adapter/vercel/index.d.ts +3 -6
  784. package/node_modules/hono/dist/types/client/client.d.ts +5 -3
  785. package/node_modules/hono/dist/types/client/fetch-result-please.d.ts +21 -19
  786. package/node_modules/hono/dist/types/client/index.d.ts +5 -7
  787. package/node_modules/hono/dist/types/client/types.d.ts +135 -160
  788. package/node_modules/hono/dist/types/client/utils.d.ts +6 -4
  789. package/node_modules/hono/dist/types/compose.d.ts +4 -2
  790. package/node_modules/hono/dist/types/context.d.ts +335 -331
  791. package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +11 -9
  792. package/node_modules/hono/dist/types/helper/accepts/index.d.ts +2 -5
  793. package/node_modules/hono/dist/types/helper/adapter/index.d.ts +4 -6
  794. package/node_modules/hono/dist/types/helper/conninfo/index.d.ts +2 -5
  795. package/node_modules/hono/dist/types/helper/conninfo/types.d.ts +25 -23
  796. package/node_modules/hono/dist/types/helper/cookie/index.d.ts +10 -12
  797. package/node_modules/hono/dist/types/helper/css/common.d.ts +11 -9
  798. package/node_modules/hono/dist/types/helper/css/index.d.ts +26 -28
  799. package/node_modules/hono/dist/types/helper/dev/index.d.ts +10 -12
  800. package/node_modules/hono/dist/types/helper/factory/index.d.ts +26 -73
  801. package/node_modules/hono/dist/types/helper/html/index.d.ts +4 -7
  802. package/node_modules/hono/dist/types/helper/proxy/index.d.ts +20 -22
  803. package/node_modules/hono/dist/types/helper/route/index.d.ts +6 -4
  804. package/node_modules/hono/dist/types/helper/ssg/index.d.ts +4 -7
  805. package/node_modules/hono/dist/types/helper/ssg/middleware.d.ts +8 -6
  806. package/node_modules/hono/dist/types/helper/ssg/plugins.d.ts +3 -1
  807. package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +44 -37
  808. package/node_modules/hono/dist/types/helper/ssg/utils.d.ts +5 -3
  809. package/node_modules/hono/dist/types/helper/streaming/index.d.ts +4 -8
  810. package/node_modules/hono/dist/types/helper/streaming/sse.d.ts +10 -8
  811. package/node_modules/hono/dist/types/helper/streaming/stream.d.ts +4 -2
  812. package/node_modules/hono/dist/types/helper/streaming/text.d.ts +4 -2
  813. package/node_modules/hono/dist/types/helper/streaming/utils.d.ts +2 -0
  814. package/node_modules/hono/dist/types/helper/testing/index.d.ts +8 -9
  815. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +30 -33
  816. package/node_modules/hono/dist/types/hono-base.d.ts +225 -210
  817. package/node_modules/hono/dist/types/hono.d.ts +11 -10
  818. package/node_modules/hono/dist/types/http-exception.d.ts +20 -22
  819. package/node_modules/hono/dist/types/index.d.ts +6 -37
  820. package/node_modules/hono/dist/types/jsx/base.d.ts +43 -36
  821. package/node_modules/hono/dist/types/jsx/children.d.ts +8 -6
  822. package/node_modules/hono/dist/types/jsx/components.d.ts +8 -5
  823. package/node_modules/hono/dist/types/jsx/constants.d.ts +3 -0
  824. package/node_modules/hono/dist/types/jsx/context.d.ts +48 -6
  825. package/node_modules/hono/dist/types/jsx/dom/client.d.ts +9 -10
  826. package/node_modules/hono/dist/types/jsx/dom/components.d.ts +9 -6
  827. package/node_modules/hono/dist/types/jsx/dom/context.d.ts +3 -1
  828. package/node_modules/hono/dist/types/jsx/dom/css.d.ts +27 -30
  829. package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +11 -12
  830. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +79 -83
  831. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +10 -6
  832. package/node_modules/hono/dist/types/jsx/dom/jsx-dev-runtime.d.ts +4 -6
  833. package/node_modules/hono/dist/types/jsx/dom/jsx-runtime.d.ts +3 -7
  834. package/node_modules/hono/dist/types/jsx/dom/render.d.ts +32 -50
  835. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +87 -85
  836. package/node_modules/hono/dist/types/jsx/dom/utils.d.ts +2 -0
  837. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +22 -20
  838. package/node_modules/hono/dist/types/jsx/index.d.ts +71 -73
  839. package/node_modules/hono/dist/types/jsx/intrinsic-element/common.d.ts +3 -1
  840. package/node_modules/hono/dist/types/jsx/intrinsic-element/components.d.ts +7 -4
  841. package/node_modules/hono/dist/types/jsx/intrinsic-elements.d.ts +708 -708
  842. package/node_modules/hono/dist/types/jsx/jsx-dev-runtime.d.ts +4 -7
  843. package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +8 -10
  844. package/node_modules/hono/dist/types/jsx/streaming.d.ts +10 -10
  845. package/node_modules/hono/dist/types/jsx/types.d.ts +12 -13
  846. package/node_modules/hono/dist/types/jsx/utils.d.ts +2 -0
  847. package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +17 -19
  848. package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +48 -49
  849. package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +6 -8
  850. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +17 -17
  851. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +8 -8
  852. package/node_modules/hono/dist/types/middleware/compress/index.d.ts +9 -10
  853. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +6 -8
  854. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +11 -13
  855. package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +6 -8
  856. package/node_modules/hono/dist/types/middleware/etag/digest.d.ts +2 -0
  857. package/node_modules/hono/dist/types/middleware/etag/index.d.ts +6 -8
  858. package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +11 -12
  859. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +13 -13
  860. package/node_modules/hono/dist/types/middleware/jwk/index.d.ts +2 -1
  861. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +21 -22
  862. package/node_modules/hono/dist/types/middleware/jwt/index.d.ts +7 -6
  863. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +29 -29
  864. package/node_modules/hono/dist/types/middleware/language/index.d.ts +6 -5
  865. package/node_modules/hono/dist/types/middleware/language/language.d.ts +60 -44
  866. package/node_modules/hono/dist/types/middleware/logger/index.d.ts +3 -5
  867. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +47 -0
  868. package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +14 -16
  869. package/node_modules/hono/dist/types/middleware/mount/index.d.ts +48 -0
  870. package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +8 -10
  871. package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +18 -20
  872. package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +6 -5
  873. package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +9 -11
  874. package/node_modules/hono/dist/types/middleware/secure-headers/index.d.ts +6 -6
  875. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +5 -3
  876. package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +55 -57
  877. package/node_modules/hono/dist/types/middleware/serve-static/index.d.ts +24 -24
  878. package/node_modules/hono/dist/types/middleware/serve-static/path.d.ts +2 -0
  879. package/node_modules/hono/dist/types/middleware/timeout/index.d.ts +5 -7
  880. package/node_modules/hono/dist/types/middleware/timing/index.d.ts +6 -5
  881. package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +17 -20
  882. package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +35 -37
  883. package/node_modules/hono/dist/types/preset/quick.d.ts +6 -9
  884. package/node_modules/hono/dist/types/preset/tiny.d.ts +6 -9
  885. package/node_modules/hono/dist/types/request/constants.d.ts +2 -0
  886. package/node_modules/hono/dist/types/request.d.ts +288 -286
  887. package/node_modules/hono/dist/types/router/linear-router/index.d.ts +2 -5
  888. package/node_modules/hono/dist/types/router/linear-router/router.d.ts +7 -5
  889. package/node_modules/hono/dist/types/router/pattern-router/index.d.ts +2 -5
  890. package/node_modules/hono/dist/types/router/pattern-router/router.d.ts +7 -5
  891. package/node_modules/hono/dist/types/router/reg-exp-router/index.d.ts +3 -6
  892. package/node_modules/hono/dist/types/router/reg-exp-router/matcher.d.ts +3 -1
  893. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +9 -4
  894. package/node_modules/hono/dist/types/router/reg-exp-router/prepared-router.d.ts +11 -10
  895. package/node_modules/hono/dist/types/router/reg-exp-router/router.d.ts +10 -9
  896. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +7 -4
  897. package/node_modules/hono/dist/types/router/smart-router/index.d.ts +2 -5
  898. package/node_modules/hono/dist/types/router/smart-router/router.d.ts +11 -9
  899. package/node_modules/hono/dist/types/router/trie-router/index.d.ts +2 -5
  900. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +6 -5
  901. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +7 -6
  902. package/node_modules/hono/dist/types/router/utils.d.ts +3 -0
  903. package/node_modules/hono/dist/types/router.d.ts +24 -23
  904. package/node_modules/hono/dist/types/types.d.ts +146 -505
  905. package/node_modules/hono/dist/types/utils/accept.d.ts +5 -3
  906. package/node_modules/hono/dist/types/utils/basic-auth.d.ts +4 -2
  907. package/node_modules/hono/dist/types/utils/body.d.ts +46 -50
  908. package/node_modules/hono/dist/types/utils/buffer.d.ts +7 -5
  909. package/node_modules/hono/dist/types/utils/color.d.ts +2 -0
  910. package/node_modules/hono/dist/types/utils/compress.d.ts +2 -0
  911. package/node_modules/hono/dist/types/utils/concurrent.d.ts +6 -4
  912. package/node_modules/hono/dist/types/utils/constants.d.ts +2 -0
  913. package/node_modules/hono/dist/types/utils/cookie.d.ts +21 -19
  914. package/node_modules/hono/dist/types/utils/crypto.d.ts +5 -7
  915. package/node_modules/hono/dist/types/utils/encode.d.ts +2 -0
  916. package/node_modules/hono/dist/types/utils/filepath.d.ts +5 -3
  917. package/node_modules/hono/dist/types/utils/handler.d.ts +2 -0
  918. package/node_modules/hono/dist/types/utils/headers.d.ts +4 -2
  919. package/node_modules/hono/dist/types/utils/html.d.ts +11 -9
  920. package/node_modules/hono/dist/types/utils/http-status.d.ts +2 -0
  921. package/node_modules/hono/dist/types/utils/ipaddr.d.ts +4 -6
  922. package/node_modules/hono/dist/types/utils/jwt/index.d.ts +18 -12
  923. package/node_modules/hono/dist/types/utils/jwt/jwa.d.ts +15 -13
  924. package/node_modules/hono/dist/types/utils/jwt/jws.d.ts +4 -7
  925. package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +26 -29
  926. package/node_modules/hono/dist/types/utils/jwt/types.d.ts +48 -45
  927. package/node_modules/hono/dist/types/utils/jwt/utf8.d.ts +2 -0
  928. package/node_modules/hono/dist/types/utils/mime.d.ts +60 -57
  929. package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
  930. package/node_modules/hono/dist/types/utils/stream.d.ts +27 -25
  931. package/node_modules/hono/dist/types/utils/types.d.ts +15 -27
  932. package/node_modules/hono/dist/types/utils/url.d.ts +7 -0
  933. package/node_modules/hono/dist/types/validator/index.d.ts +3 -7
  934. package/node_modules/hono/dist/types/validator/utils.d.ts +6 -8
  935. package/node_modules/hono/dist/types/validator/validator.d.ts +11 -9
  936. package/node_modules/hono/dist/types.js +4 -6
  937. package/node_modules/hono/dist/utils/accept.js +185 -215
  938. package/node_modules/hono/dist/utils/basic-auth.js +18 -21
  939. package/node_modules/hono/dist/utils/body.js +88 -67
  940. package/node_modules/hono/dist/utils/buffer.js +44 -70
  941. package/node_modules/hono/dist/utils/color.js +33 -21
  942. package/node_modules/hono/dist/utils/compress.js +11 -5
  943. package/node_modules/hono/dist/utils/concurrent.js +29 -38
  944. package/node_modules/hono/dist/utils/constants.js +7 -5
  945. package/node_modules/hono/dist/utils/cookie.js +115 -163
  946. package/node_modules/hono/dist/utils/crypto.js +30 -40
  947. package/node_modules/hono/dist/utils/encode.js +30 -26
  948. package/node_modules/hono/dist/utils/filepath.js +23 -33
  949. package/node_modules/hono/dist/utils/handler.js +10 -11
  950. package/node_modules/hono/dist/utils/headers.js +1 -0
  951. package/node_modules/hono/dist/utils/html.js +97 -117
  952. package/node_modules/hono/dist/utils/http-status.js +1 -0
  953. package/node_modules/hono/dist/utils/ipaddr.js +227 -272
  954. package/node_modules/hono/dist/utils/jwt/index.js +12 -4
  955. package/node_modules/hono/dist/utils/jwt/jwa.js +24 -20
  956. package/node_modules/hono/dist/utils/jwt/jws.js +115 -174
  957. package/node_modules/hono/dist/utils/jwt/jwt.js +121 -197
  958. package/node_modules/hono/dist/utils/jwt/types.js +79 -95
  959. package/node_modules/hono/dist/utils/jwt/utf8.js +9 -7
  960. package/node_modules/hono/dist/utils/mime.js +74 -79
  961. package/node_modules/hono/dist/utils/mount.js +50 -0
  962. package/node_modules/hono/dist/utils/stream.js +86 -79
  963. package/node_modules/hono/dist/utils/types.js +1 -0
  964. package/node_modules/hono/dist/utils/url.js +199 -208
  965. package/node_modules/hono/dist/validator/index.js +1 -4
  966. package/node_modules/hono/dist/validator/utils.js +1 -0
  967. package/node_modules/hono/dist/validator/validator.js +61 -83
  968. package/node_modules/hono/package.json +69 -47
  969. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  970. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  971. package/node_modules/iconv-lite/package.json +2 -2
  972. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  973. package/node_modules/ip-address/README.md +173 -143
  974. package/node_modules/ip-address/dist/address-error.d.ts +11 -0
  975. package/node_modules/ip-address/dist/address-error.js.map +1 -1
  976. package/node_modules/ip-address/dist/common.d.ts +54 -0
  977. package/node_modules/ip-address/dist/common.js +93 -6
  978. package/node_modules/ip-address/dist/common.js.map +1 -1
  979. package/node_modules/ip-address/dist/ipv4.d.ts +88 -8
  980. package/node_modules/ip-address/dist/ipv4.js +146 -29
  981. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  982. package/node_modules/ip-address/dist/ipv6.d.ts +156 -11
  983. package/node_modules/ip-address/dist/ipv6.js +340 -96
  984. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  985. package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
  986. package/node_modules/ip-address/dist/v4/constants.js +45 -2
  987. package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
  988. package/node_modules/ip-address/dist/v6/constants.d.ts +17 -0
  989. package/node_modules/ip-address/dist/v6/constants.js +53 -3
  990. package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
  991. package/node_modules/ip-address/package.json +8 -5
  992. package/node_modules/proxy-addr/HISTORY.md +60 -54
  993. package/node_modules/proxy-addr/README.md +1 -1
  994. package/node_modules/proxy-addr/index.js +32 -0
  995. package/node_modules/proxy-addr/package.json +8 -4
  996. package/node_modules/qs/.editorconfig +1 -1
  997. package/node_modules/qs/.github/THREAT_MODEL.md +6 -4
  998. package/node_modules/qs/CHANGELOG.md +116 -1
  999. package/node_modules/qs/README.md +107 -8
  1000. package/node_modules/qs/dist/qs.js +28 -28
  1001. package/node_modules/qs/eslint.config.mjs +61 -50
  1002. package/node_modules/qs/lib/formats.js +7 -2
  1003. package/node_modules/qs/lib/parse.js +137 -18
  1004. package/node_modules/qs/lib/stringify.js +32 -15
  1005. package/node_modules/qs/lib/utils.js +213 -24
  1006. package/node_modules/qs/package.json +11 -10
  1007. package/node_modules/qs/test/parse.js +928 -2
  1008. package/node_modules/qs/test/stringify.js +769 -0
  1009. package/node_modules/qs/test/utils.js +450 -2
  1010. package/node_modules/side-channel/CHANGELOG.md +10 -0
  1011. package/node_modules/side-channel/README.md +1 -1
  1012. package/node_modules/side-channel/index.js +5 -2
  1013. package/node_modules/side-channel/package.json +10 -10
  1014. package/node_modules/side-channel/test/index.js +16 -0
  1015. package/node_modules/side-channel-list/CHANGELOG.md +25 -4
  1016. package/node_modules/side-channel-list/index.js +1 -3
  1017. package/node_modules/side-channel-list/package.json +8 -8
  1018. package/node_modules/side-channel-list/test/index.js +50 -0
  1019. package/node_modules/type-is/index.js +8 -18
  1020. package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
  1021. package/node_modules/type-is/node_modules/content-type/README.md +71 -0
  1022. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +46 -0
  1023. package/node_modules/type-is/node_modules/content-type/dist/index.js +176 -0
  1024. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
  1025. package/node_modules/type-is/node_modules/content-type/package.json +52 -0
  1026. package/node_modules/type-is/package.json +9 -5
  1027. package/package.json +1 -1
  1028. package/node_modules/@hono/node-server/dist/conninfo.js +0 -42
  1029. package/node_modules/@hono/node-server/dist/globals.d.mts +0 -2
  1030. package/node_modules/@hono/node-server/dist/globals.d.ts +0 -2
  1031. package/node_modules/@hono/node-server/dist/globals.js +0 -29
  1032. package/node_modules/@hono/node-server/dist/globals.mjs +0 -5
  1033. package/node_modules/@hono/node-server/dist/index.d.ts +0 -8
  1034. package/node_modules/@hono/node-server/dist/index.js +0 -702
  1035. package/node_modules/@hono/node-server/dist/listener.d.mts +0 -13
  1036. package/node_modules/@hono/node-server/dist/listener.d.ts +0 -13
  1037. package/node_modules/@hono/node-server/dist/listener.js +0 -670
  1038. package/node_modules/@hono/node-server/dist/listener.mjs +0 -635
  1039. package/node_modules/@hono/node-server/dist/request.d.mts +0 -25
  1040. package/node_modules/@hono/node-server/dist/request.d.ts +0 -25
  1041. package/node_modules/@hono/node-server/dist/request.js +0 -238
  1042. package/node_modules/@hono/node-server/dist/request.mjs +0 -206
  1043. package/node_modules/@hono/node-server/dist/response.d.mts +0 -26
  1044. package/node_modules/@hono/node-server/dist/response.d.ts +0 -26
  1045. package/node_modules/@hono/node-server/dist/response.js +0 -112
  1046. package/node_modules/@hono/node-server/dist/response.mjs +0 -85
  1047. package/node_modules/@hono/node-server/dist/serve-static.d.ts +0 -17
  1048. package/node_modules/@hono/node-server/dist/serve-static.js +0 -177
  1049. package/node_modules/@hono/node-server/dist/server.d.mts +0 -10
  1050. package/node_modules/@hono/node-server/dist/server.d.ts +0 -10
  1051. package/node_modules/@hono/node-server/dist/server.js +0 -696
  1052. package/node_modules/@hono/node-server/dist/server.mjs +0 -660
  1053. package/node_modules/@hono/node-server/dist/types.d.mts +0 -44
  1054. package/node_modules/@hono/node-server/dist/types.d.ts +0 -44
  1055. package/node_modules/@hono/node-server/dist/types.js +0 -18
  1056. package/node_modules/@hono/node-server/dist/types.mjs +0 -0
  1057. package/node_modules/@hono/node-server/dist/utils/response/constants.d.mts +0 -3
  1058. package/node_modules/@hono/node-server/dist/utils/response/constants.d.ts +0 -3
  1059. package/node_modules/@hono/node-server/dist/utils/response/constants.js +0 -30
  1060. package/node_modules/@hono/node-server/dist/utils/response/constants.mjs +0 -5
  1061. package/node_modules/@hono/node-server/dist/utils/response.d.ts +0 -3
  1062. package/node_modules/@hono/node-server/dist/utils/response.js +0 -37
  1063. package/node_modules/@hono/node-server/dist/utils.d.mts +0 -9
  1064. package/node_modules/@hono/node-server/dist/utils.d.ts +0 -9
  1065. package/node_modules/@hono/node-server/dist/utils.js +0 -99
  1066. package/node_modules/@hono/node-server/dist/utils.mjs +0 -71
  1067. package/node_modules/@hono/node-server/dist/vercel.d.mts +0 -7
  1068. package/node_modules/@hono/node-server/dist/vercel.d.ts +0 -7
  1069. package/node_modules/@hono/node-server/dist/vercel.js +0 -677
  1070. package/node_modules/@hono/node-server/dist/vercel.mjs +0 -640
  1071. package/node_modules/hasown/.eslintrc +0 -5
  1072. package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,4 +1,4 @@
1
- /*! Axios v1.17.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.21.1 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  'use strict';
3
3
 
4
4
  /**
@@ -20,6 +20,179 @@ const { toString } = Object.prototype;
20
20
  const { getPrototypeOf } = Object;
21
21
  const { iterator, toStringTag } = Symbol;
22
22
 
23
+ /* Creating a function that will check if an object has a property. */
24
+ const hasOwnProperty = (
25
+ ({ hasOwnProperty }) =>
26
+ (obj, prop) =>
27
+ hasOwnProperty.call(obj, prop)
28
+ )(Object.prototype);
29
+
30
+ const isUnsafeObjectKey = (prop) =>
31
+ typeof prop === 'string' &&
32
+ (prop === '__proto__' || prop === 'constructor' || prop === 'prototype');
33
+
34
+ /**
35
+ * Determine whether an inherited object must be treated as a shared-prototype
36
+ * boundary. Cross-realm Object.prototype objects cannot be distinguished
37
+ * reliably from application-created null-prototype objects because their
38
+ * properties are mutable, so all inherited terminal prototypes are excluded
39
+ * as a fail-closed boundary. A null-prototype source still keeps its own
40
+ * properties, as produced by mergeConfig and other safe materialization paths.
41
+ *
42
+ * @param {*} obj The object to inspect
43
+ * @param {*} prototype The object's prototype
44
+ * @param {boolean} source Whether obj is the original traversal source
45
+ *
46
+ * @returns {boolean} True when obj is a safe prototype traversal boundary
47
+ */
48
+ const isPrototypeBoundary = (obj, prototype, source) =>
49
+ obj === Object.prototype || (!source && prototype === null);
50
+
51
+ /**
52
+ * Determine whether an object can retain its identity through code paths that
53
+ * add, replace, and remove config properties without bypassing unsafe-key
54
+ * filtering. Immutable objects, unsafe-key-bearing objects, and objects with
55
+ * accessor or restricted data properties must be materialized instead.
56
+ *
57
+ * @param {*} obj The object to inspect
58
+ *
59
+ * @returns {boolean} True when every own property is safe and fully mutable
60
+ */
61
+ const isSafeAndFullyMutable = (obj) => {
62
+ if (!Object.isExtensible(obj)) {
63
+ return false;
64
+ }
65
+
66
+ const props = Object.getOwnPropertyNames(obj);
67
+
68
+ if (Object.getOwnPropertySymbols) {
69
+ props.push(...Object.getOwnPropertySymbols(obj));
70
+ }
71
+
72
+ return props.every((prop) => {
73
+ if (isUnsafeObjectKey(prop)) {
74
+ return false;
75
+ }
76
+
77
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
78
+
79
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
80
+ });
81
+ };
82
+
83
+ /**
84
+ * Walk the prototype chain (excluding the source realm's Object.prototype)
85
+ * looking for an own `prop`. This distinguishes genuine own/inherited members
86
+ * — including class accessors and template prototypes — from members injected
87
+ * via Object.prototype pollution (e.g. `Object.prototype.username = '...'`),
88
+ * which live on Object.prototype itself and are therefore never matched.
89
+ *
90
+ * @param {*} thing The value whose chain to inspect
91
+ * @param {string|symbol} prop The property key to look for
92
+ *
93
+ * @returns {boolean} True when `prop` is owned below Object.prototype
94
+ */
95
+ const hasOwnInPrototypeChain = (thing, prop) => {
96
+ let obj = thing;
97
+ const seen = [];
98
+
99
+ while (obj != null) {
100
+ if (seen.indexOf(obj) !== -1) {
101
+ return false;
102
+ }
103
+ seen.push(obj);
104
+
105
+ const prototype = getPrototypeOf(obj);
106
+
107
+ if (isPrototypeBoundary(obj, prototype, obj === thing)) {
108
+ return false;
109
+ }
110
+
111
+ if (hasOwnProperty(obj, prop)) {
112
+ return true;
113
+ }
114
+ obj = prototype;
115
+ }
116
+ return false;
117
+ };
118
+
119
+ /**
120
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
121
+ * properties and members inherited from a non-Object.prototype source (a class
122
+ * instance or template object) are honored; a value reachable only through a
123
+ * polluted Object.prototype is ignored and `undefined` is returned.
124
+ *
125
+ * @param {*} obj The source object
126
+ * @param {string|symbol} prop The property key to read
127
+ *
128
+ * @returns {*} The resolved value, or undefined when unsafe/absent
129
+ */
130
+ const getSafeProp = (obj, prop) =>
131
+ obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
132
+
133
+ /**
134
+ * Flatten an object and its application-defined prototype chain into a
135
+ * null-prototype object. Members inherited only from the source realm's
136
+ * Object.prototype are deliberately excluded, while class/template members
137
+ * below that boundary are preserved.
138
+ *
139
+ * @param {*} thing The value to flatten
140
+ *
141
+ * @returns {*} A null-prototype copy, or the original value when it is already
142
+ * structurally safe or is not an object
143
+ */
144
+ const toSafeFlatObject = (thing) => {
145
+ if (thing == null || (typeof thing !== 'object' && typeof thing !== 'function')) {
146
+ return thing;
147
+ }
148
+
149
+ const sourcePrototype = getPrototypeOf(thing);
150
+
151
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
152
+ return thing;
153
+ }
154
+
155
+ const result = Object.create(null);
156
+ const merged = Object.create(null);
157
+ const seen = [];
158
+ let current = thing;
159
+
160
+ while (current != null) {
161
+ if (seen.indexOf(current) !== -1) {
162
+ break;
163
+ }
164
+
165
+ seen.push(current);
166
+
167
+ const prototype = current === thing ? sourcePrototype : getPrototypeOf(current);
168
+
169
+ if (isPrototypeBoundary(current, prototype, current === thing)) {
170
+ break;
171
+ }
172
+
173
+ const props = Object.getOwnPropertyNames(current);
174
+
175
+ if (Object.getOwnPropertySymbols) {
176
+ props.push(...Object.getOwnPropertySymbols(current));
177
+ }
178
+
179
+ for (const prop of props) {
180
+ if (isUnsafeObjectKey(prop)) {
181
+ continue;
182
+ }
183
+
184
+ if (!hasOwnProperty(merged, prop)) {
185
+ result[prop] = thing[prop];
186
+ merged[prop] = true;
187
+ }
188
+ }
189
+
190
+ current = prototype;
191
+ }
192
+
193
+ return result;
194
+ };
195
+
23
196
  const kindOf = ((cache) => (thing) => {
24
197
  const str = toString.call(thing);
25
198
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -145,17 +318,24 @@ const isBoolean = (thing) => thing === true || thing === false;
145
318
  * @returns {boolean} True if value is a plain Object, otherwise false
146
319
  */
147
320
  const isPlainObject = (val) => {
148
- if (kindOf(val) !== 'object') {
321
+ if (!isObject(val)) {
149
322
  return false;
150
323
  }
151
324
 
152
325
  const prototype = getPrototypeOf(val);
153
326
  return (
154
- (prototype === null ||
155
- prototype === Object.prototype ||
156
- Object.getPrototypeOf(prototype) === null) &&
157
- !(toStringTag in val) &&
158
- !(iterator in val)
327
+ (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
328
+ // Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
329
+ // value is tagged/iterable, ignoring members reachable only through shared
330
+ // or terminal prototype boundaries. This is exactly what
331
+ // hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
332
+ // above (null, Object.prototype, or a terminal null-prototype template) is
333
+ // a boundary, so the walk never inspects anything but `val`'s own members,
334
+ // and stops before even those when `val` is itself the boundary
335
+ // Object.prototype. Checking that inline avoids allocating the walker's
336
+ // `seen` list twice per call on the mergeConfig / merge hot path.
337
+ (isPrototypeBoundary(val, prototype, true) ||
338
+ (!hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator)))
159
339
  );
160
340
  };
161
341
 
@@ -240,6 +420,7 @@ const isBlob = kindOfTest('Blob');
240
420
  * @returns {boolean} True if value is a FileList, otherwise false
241
421
  */
242
422
  const isFileList = kindOfTest('FileList');
423
+ const isSet = kindOfTest('Set');
243
424
 
244
425
  /**
245
426
  * Determine if a value is a Stream
@@ -418,15 +599,30 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
418
599
  function merge(...objs) {
419
600
  const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
420
601
  const result = {};
602
+ // Caseless lookup only applies to string keys — symbol keys are
603
+ // identity-matched. Every string key that reaches `result` passes through
604
+ // this index first, so it can never hold two case variants of one key and a
605
+ // lowercase -> key map is exactly what findKey(result, key) would rescan
606
+ // Object.keys(result) for on each assignment.
607
+ const lowerCaseKeys = caseless ? Object.create(null) : null;
421
608
  const assignValue = (val, key) => {
422
609
  // Skip dangerous property names to prevent prototype pollution
423
610
  if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
424
611
  return;
425
612
  }
426
613
 
427
- // findKey lowercases the key, so caseless lookup only applies to strings —
428
- // symbol keys are identity-matched.
429
- const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;
614
+ let targetKey = key;
615
+ if (lowerCaseKeys && typeof key === 'string') {
616
+ const lowerKey = key.toLowerCase();
617
+ const knownKey = lowerCaseKeys[lowerKey];
618
+ // A key recorded but absent from `result` was skipped by skipUndefined;
619
+ // the later spelling wins then, as it does for findKey.
620
+ if (knownKey !== undefined && hasOwnProperty(result, knownKey)) {
621
+ targetKey = knownKey;
622
+ } else {
623
+ lowerCaseKeys[lowerKey] = key;
624
+ }
625
+ }
430
626
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
431
627
  // chain, so a polluted Object.prototype value could surface here and get
432
628
  // copied into the merged result.
@@ -450,7 +646,7 @@ function merge(...objs) {
450
646
 
451
647
  forEach(source, assignValue);
452
648
 
453
- if (typeof source !== 'object' || isArray(source)) {
649
+ if (typeof source !== 'object' || isArray(source) || !Object.getOwnPropertySymbols) {
454
650
  continue;
455
651
  }
456
652
 
@@ -609,7 +805,37 @@ const toArray = (thing) => {
609
805
  if (!thing) return null;
610
806
  if (isArray(thing)) return thing;
611
807
  let i = thing.length;
612
- if (!isNumber(i)) return null;
808
+ if (!Number.isSafeInteger(i) || i < 0 || i > 0xffffffff) return null;
809
+
810
+ // Bound the copy by actual indexed properties, including hidden and inherited
811
+ // members of array-like collections, rather than by the declared length alone.
812
+ const indexes = new Set();
813
+ const seen = new Set();
814
+ let source = thing;
815
+
816
+ while (source != null && indexes.size < i) {
817
+ if (seen.has(source)) return null;
818
+ seen.add(source);
819
+
820
+ const prototype = getPrototypeOf(source);
821
+ if (isPrototypeBoundary(source, prototype, source === thing)) break;
822
+
823
+ Object.getOwnPropertyNames(source).forEach((key) => {
824
+ const index = +key;
825
+ if (
826
+ Number.isInteger(index) &&
827
+ index >= 0 &&
828
+ index < i &&
829
+ String(index) === key &&
830
+ hasOwnProperty(source, key)
831
+ ) {
832
+ indexes.add(index);
833
+ }
834
+ });
835
+ source = prototype;
836
+ }
837
+
838
+ if (indexes.size !== i) return null;
613
839
  const arr = new Array(i);
614
840
  while (i-- > 0) {
615
841
  arr[i] = thing[i];
@@ -682,13 +908,6 @@ const toCamelCase = (str) => {
682
908
  });
683
909
  };
684
910
 
685
- /* Creating a function that will check if an object has a property. */
686
- const hasOwnProperty = (
687
- ({ hasOwnProperty }) =>
688
- (obj, prop) =>
689
- hasOwnProperty.call(obj, prop)
690
- )(Object.prototype);
691
-
692
911
  const { propertyIsEnumerable } = Object.prototype;
693
912
 
694
913
  /**
@@ -812,12 +1031,23 @@ const toJSONObject = (obj) => {
812
1031
  if (!('toJSON' in source)) {
813
1032
  // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
814
1033
  visited.add(source);
815
- const target = isArray(source) ? [] : {};
816
1034
 
817
- forEach(source, (value, key) => {
818
- const reducedValue = visit(value);
819
- !isUndefined(reducedValue) && (target[key] = reducedValue);
820
- });
1035
+ let target;
1036
+
1037
+ if (isSet(source)) {
1038
+ target = [];
1039
+ for (const value of source) {
1040
+ const reducedValue = visit(value);
1041
+ !isUndefined(reducedValue) && target.push(reducedValue);
1042
+ }
1043
+ } else {
1044
+ target = isArray(source) ? [] : {};
1045
+
1046
+ forEach(source, (value, key) => {
1047
+ const reducedValue = visit(value);
1048
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
1049
+ });
1050
+ }
821
1051
 
822
1052
  visited.delete(source);
823
1053
 
@@ -902,6 +1132,20 @@ const asap =
902
1132
 
903
1133
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
904
1134
 
1135
+ /**
1136
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
1137
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
1138
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
1139
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
1140
+ * into an attacker-controlled entries iterator.
1141
+ *
1142
+ * @param {*} thing The value to test
1143
+ *
1144
+ * @returns {boolean} True if value has a non-polluted iterator
1145
+ */
1146
+ const isSafeIterable = (thing) =>
1147
+ thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
1148
+
905
1149
  var utils$1 = {
906
1150
  isArray,
907
1151
  isArrayBuffer,
@@ -946,6 +1190,9 @@ var utils$1 = {
946
1190
  isHTMLForm,
947
1191
  hasOwnProperty,
948
1192
  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
1193
+ hasOwnInPrototypeChain,
1194
+ getSafeProp,
1195
+ toSafeFlatObject,
949
1196
  reduceDescriptors,
950
1197
  freezeMethods,
951
1198
  toObjectSet,
@@ -962,6 +1209,7 @@ var utils$1 = {
962
1209
  setImmediate: _setImmediate,
963
1210
  asap,
964
1211
  isIterable,
1212
+ isSafeIterable,
965
1213
  };
966
1214
 
967
1215
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -1001,7 +1249,8 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
1001
1249
  * @returns {Object} Headers parsed into an object
1002
1250
  */
1003
1251
  var parseHeaders = (rawHeaders) => {
1004
- const parsed = {};
1252
+ // Header names are data, including __proto__; avoid inherited setters.
1253
+ const parsed = Object.create(null);
1005
1254
  let key;
1006
1255
  let val;
1007
1256
  let i;
@@ -1012,18 +1261,20 @@ var parseHeaders = (rawHeaders) => {
1012
1261
  key = line.substring(0, i).trim().toLowerCase();
1013
1262
  val = line.substring(i + 1).trim();
1014
1263
 
1015
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1264
+ const hasKey = utils$1.hasOwnProp(parsed, key);
1265
+
1266
+ if (!key || (hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key))) {
1016
1267
  return;
1017
1268
  }
1018
1269
 
1019
1270
  if (key === 'set-cookie') {
1020
- if (parsed[key]) {
1271
+ if (hasKey) {
1021
1272
  parsed[key].push(val);
1022
1273
  } else {
1023
1274
  parsed[key] = [val];
1024
1275
  }
1025
1276
  } else {
1026
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1277
+ parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
1027
1278
  }
1028
1279
  });
1029
1280
 
@@ -1087,7 +1338,7 @@ function toByteStringHeaderObject(headers) {
1087
1338
  return byteStringHeaders;
1088
1339
  }
1089
1340
 
1090
- const $internals = Symbol('internals');
1341
+ const $internals$1 = Symbol('internals');
1091
1342
 
1092
1343
  function normalizeHeader(header) {
1093
1344
  return header && String(header).trim().toLowerCase();
@@ -1113,11 +1364,142 @@ function parseTokens(str) {
1113
1364
  return tokens;
1114
1365
  }
1115
1366
 
1367
+ const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
1368
+
1369
+ function trimOWS(value) {
1370
+ let start = 0;
1371
+ let end = value.length;
1372
+
1373
+ while (start < end) {
1374
+ const code = value.charCodeAt(start);
1375
+
1376
+ if (code !== 0x09 && code !== 0x20) {
1377
+ break;
1378
+ }
1379
+
1380
+ start += 1;
1381
+ }
1382
+
1383
+ while (end > start) {
1384
+ const code = value.charCodeAt(end - 1);
1385
+
1386
+ if (code !== 0x09 && code !== 0x20) {
1387
+ break;
1388
+ }
1389
+
1390
+ end -= 1;
1391
+ }
1392
+
1393
+ return start === 0 && end === value.length ? value : value.slice(start, end);
1394
+ }
1395
+
1396
+ function decodeQuotedString(value) {
1397
+ const last = value.length - 1;
1398
+
1399
+ if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
1400
+ return value;
1401
+ }
1402
+
1403
+ let decoded = '';
1404
+
1405
+ for (let i = 1; i < last; i++) {
1406
+ const code = value.charCodeAt(i);
1407
+
1408
+ if (code === 0x22) {
1409
+ return value;
1410
+ }
1411
+
1412
+ if (code === 0x5c) {
1413
+ i += 1;
1414
+
1415
+ if (i >= last) {
1416
+ return value;
1417
+ }
1418
+ }
1419
+
1420
+ decoded += value[i];
1421
+ }
1422
+
1423
+ return decoded;
1424
+ }
1425
+
1426
+ function parseParameters(value) {
1427
+ const parameters = Object.create(null);
1428
+ const str = String(value);
1429
+ let start = 0;
1430
+ let quoted = false;
1431
+ let escaped = false;
1432
+
1433
+ function parseParameter(end) {
1434
+ const part = trimOWS(str.slice(start, end));
1435
+ const equals = part.indexOf('=');
1436
+
1437
+ if (equals < 1) {
1438
+ return;
1439
+ }
1440
+
1441
+ const name = trimOWS(part.slice(0, equals));
1442
+
1443
+ if (!parameterNameRE.test(name)) {
1444
+ return;
1445
+ }
1446
+
1447
+ const normalizedName = name.toLowerCase();
1448
+
1449
+ if (
1450
+ normalizedName === '__proto__' ||
1451
+ normalizedName === 'constructor' ||
1452
+ normalizedName === 'prototype'
1453
+ ) {
1454
+ return;
1455
+ }
1456
+
1457
+ const parameterValue = trimOWS(part.slice(equals + 1));
1458
+ parameters[normalizedName] = decodeQuotedString(parameterValue);
1459
+ }
1460
+
1461
+ for (let i = 0; i < str.length; i++) {
1462
+ const code = str.charCodeAt(i);
1463
+
1464
+ if (quoted) {
1465
+ if (escaped) {
1466
+ escaped = false;
1467
+ } else if (code === 0x5c) {
1468
+ escaped = true;
1469
+ } else if (code === 0x22) {
1470
+ quoted = false;
1471
+ }
1472
+ } else if (code === 0x22) {
1473
+ quoted = true;
1474
+ } else if (code === 0x2c || code === 0x3b) {
1475
+ parseParameter(i);
1476
+ start = i + 1;
1477
+ }
1478
+ }
1479
+
1480
+ parseParameter(str.length);
1481
+
1482
+ return parameters;
1483
+ }
1484
+
1116
1485
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1117
1486
 
1487
+ // `__proto__` is a valid field name, and the one name the uppercase mapping at
1488
+ // the bottom of this file cannot reach: it is inherited from Object.prototype
1489
+ // instead of being declared on AxiosHeaders.prototype, so `self.__proto__ = v`
1490
+ // runs the inherited setter. That silently discards the header, and an array
1491
+ // value replaces the instance prototype, taking every method with it.
1492
+ // Store it under the same kind of case variant that mapping uses for `set` and
1493
+ // `constructor`. Header lookup is caseless, so it reads back under either
1494
+ // spelling, and no own `__proto__` slot is ever created for a later
1495
+ // `Object.assign` to copy onto a plain object through the same setter.
1496
+ const PROTO_HEADER_SLOT = '__Proto__';
1497
+
1498
+ const headerSlot = (name) => (name === '__proto__' ? PROTO_HEADER_SLOT : name);
1499
+
1118
1500
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1119
1501
  if (utils$1.isFunction(filter)) {
1120
- return filter.call(this, value, header);
1502
+ return filter.call(context, value, header);
1121
1503
  }
1122
1504
 
1123
1505
  if (isHeaderNameFilter) {
@@ -1183,7 +1565,7 @@ class AxiosHeaders {
1183
1565
  _rewrite === true ||
1184
1566
  (_rewrite === undefined && self[key] !== false)
1185
1567
  ) {
1186
- self[key || _header] = normalizeValue(_value);
1568
+ self[headerSlot(key || _header)] = normalizeValue(_value);
1187
1569
  }
1188
1570
  }
1189
1571
 
@@ -1194,8 +1576,8 @@ class AxiosHeaders {
1194
1576
  setHeaders(header, valueOrRewrite);
1195
1577
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1196
1578
  setHeaders(parseHeaders(header), valueOrRewrite);
1197
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1198
- let obj = {},
1579
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
1580
+ let obj = Object.create(null),
1199
1581
  dest,
1200
1582
  key;
1201
1583
  for (const entry of header) {
@@ -1203,11 +1585,14 @@ class AxiosHeaders {
1203
1585
  throw new TypeError('Object iterator must return a key-value pair');
1204
1586
  }
1205
1587
 
1206
- obj[(key = entry[0])] = (dest = obj[key])
1207
- ? utils$1.isArray(dest)
1208
- ? [...dest, entry[1]]
1209
- : [dest, entry[1]]
1210
- : entry[1];
1588
+ key = entry[0];
1589
+
1590
+ if (utils$1.hasOwnProp(obj, key)) {
1591
+ dest = obj[key];
1592
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
1593
+ } else {
1594
+ obj[key] = entry[1];
1595
+ }
1211
1596
  }
1212
1597
 
1213
1598
  setHeaders(obj, valueOrRewrite);
@@ -1309,7 +1694,7 @@ class AxiosHeaders {
1309
1694
 
1310
1695
  normalize(format) {
1311
1696
  const self = this;
1312
- const headers = {};
1697
+ const headers = Object.create(null);
1313
1698
 
1314
1699
  utils$1.forEach(this, (value, header) => {
1315
1700
  const key = utils$1.findKey(headers, header);
@@ -1320,7 +1705,7 @@ class AxiosHeaders {
1320
1705
  return;
1321
1706
  }
1322
1707
 
1323
- const normalized = format ? formatHeader(header) : String(header).trim();
1708
+ const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
1324
1709
 
1325
1710
  if (normalized !== header) {
1326
1711
  delete self[header];
@@ -1361,7 +1746,8 @@ class AxiosHeaders {
1361
1746
  }
1362
1747
 
1363
1748
  getSetCookie() {
1364
- return this.get('set-cookie') || [];
1749
+ const value = this.get('set-cookie');
1750
+ return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
1365
1751
  }
1366
1752
 
1367
1753
  get [Symbol.toStringTag]() {
@@ -1372,6 +1758,10 @@ class AxiosHeaders {
1372
1758
  return thing instanceof this ? thing : new this(thing);
1373
1759
  }
1374
1760
 
1761
+ static parseParameters(value) {
1762
+ return parseParameters(value);
1763
+ }
1764
+
1375
1765
  static concat(first, ...targets) {
1376
1766
  const computed = new this(first);
1377
1767
 
@@ -1382,8 +1772,8 @@ class AxiosHeaders {
1382
1772
 
1383
1773
  static accessor(header) {
1384
1774
  const internals =
1385
- (this[$internals] =
1386
- this[$internals] =
1775
+ (this[$internals$1] =
1776
+ this[$internals$1] =
1387
1777
  {
1388
1778
  accessors: {},
1389
1779
  });
@@ -1497,12 +1887,114 @@ function redactConfig(config, redactKeys) {
1497
1887
  return visit(config);
1498
1888
  }
1499
1889
 
1890
+ function stringifySafely$1(value) {
1891
+ try {
1892
+ return String(value);
1893
+ } catch (err) {
1894
+ return '';
1895
+ }
1896
+ }
1897
+
1898
+ function aggregateErrorMessage(error) {
1899
+ const message = error.errors
1900
+ .map((entry) => {
1901
+ try {
1902
+ return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
1903
+ } catch (err) {
1904
+ return '';
1905
+ }
1906
+ })
1907
+ .filter(Boolean)
1908
+ .join('; ');
1909
+
1910
+ return message || error.name || 'AggregateError';
1911
+ }
1912
+
1913
+ // Shared with `Axios.prototype.request`, which splices the reconstructed
1914
+ // caller frames in ahead of this marker.
1915
+ const CAUSED_BY_SEPARATOR = '\nCaused by: ';
1916
+ const $causeStack = Symbol('causeStack');
1917
+
1918
+ // Match the section we appended, not marker-like text in an error message or
1919
+ // a replacement stack supplied by the caller. Do not re-read the cause's stack.
1920
+ function getCauseStackIndex(error, stack) {
1921
+ const causeStack = utils$1.hasOwnProp(error, $causeStack) && error[$causeStack];
1922
+
1923
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
1924
+ }
1925
+
1926
+ /**
1927
+ * Append the stack of a wrapped error to `target.stack`.
1928
+ *
1929
+ * `cause` already exposes the original error for tooling that walks the standard
1930
+ * cause chain, but many error reporters read `stack` and nothing else. Inlining
1931
+ * the wrapped stack there means those reporters surface the underlying failure
1932
+ * instead of the axios frames that normalized it (see #6670).
1933
+ *
1934
+ * Every read is defensive: a custom `Error.prepareStackTrace` hook, a runtime
1935
+ * without stack support, or a replaced `stack` property can leave the value
1936
+ * missing, non-string, or read-only, and normalizing an error must not throw
1937
+ * because of that.
1938
+ *
1939
+ * @param {Error} target The AxiosError being built.
1940
+ * @param {Error} source The error being wrapped.
1941
+ *
1942
+ * @returns {void}
1943
+ */
1944
+ function appendCauseStack(target, source) {
1945
+ try {
1946
+ const sourceStack = source && source.stack;
1947
+
1948
+ if (typeof sourceStack !== 'string' || !sourceStack) {
1949
+ return;
1950
+ }
1951
+
1952
+ const targetStack = target.stack;
1953
+
1954
+ if (typeof targetStack !== 'string' || !targetStack) {
1955
+ return;
1956
+ }
1957
+
1958
+ // Each call to `from()` creates a fresh target. Re-wrapping includes the
1959
+ // previous stack verbatim, adding one cause section per wrap.
1960
+ const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
1961
+ target.stack = targetStack + causeStack;
1962
+ Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
1963
+ } catch (e) {
1964
+ // Ignore failures from custom stack hooks or un-writable stack properties.
1965
+ }
1966
+ }
1967
+
1500
1968
  class AxiosError extends Error {
1501
1969
  static from(error, code, config, request, response, customProps) {
1502
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1503
- axiosError.cause = error;
1970
+ // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
1971
+ // failures) has an empty `message`; its detail lives in `errors[]`. Without
1972
+ // this, the wrapped error surfaces with a blank message (see #6721).
1973
+ let message = error.message;
1974
+ if (!message && utils$1.isArray(error.errors) && error.errors.length) {
1975
+ message = aggregateErrorMessage(error);
1976
+ }
1977
+
1978
+ const axiosError = new AxiosError(message, code || error.code, config, request, response);
1979
+ // Match native `Error` `cause` semantics: non-enumerable. The wrapped
1980
+ // error often carries circular internals (sockets, requests, agents), so
1981
+ // an enumerable `cause` makes structured loggers (pino/winston) and any
1982
+ // own-property walk throw "Converting circular structure to JSON".
1983
+ // Regression from #6982; see #7205. `__proto__: null` mirrors the
1984
+ // `message` descriptor below (prototype-pollution-safe descriptor).
1985
+ Object.defineProperty(axiosError, 'cause', {
1986
+ __proto__: null,
1987
+ value: error,
1988
+ writable: true,
1989
+ enumerable: false,
1990
+ configurable: true,
1991
+ });
1504
1992
  axiosError.name = error.name;
1505
1993
 
1994
+ // Inline the wrapped stack for reporters that read only `stack`; the `cause`
1995
+ // property above already covers cause-aware tooling.
1996
+ appendCauseStack(axiosError, error);
1997
+
1506
1998
  // Preserve status from the original error if not already set from response
1507
1999
  if (error.status != null && axiosError.status == null) {
1508
2000
  axiosError.status = error.status;
@@ -1601,6 +2093,10 @@ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1601
2093
  // eslint-disable-next-line strict
1602
2094
  var httpAdapter = null;
1603
2095
 
2096
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
2097
+ // the FormData <-> JSON round-trip stays symmetric.
2098
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
2099
+
1604
2100
  /**
1605
2101
  * Determines if the given thing is a array or js object.
1606
2102
  *
@@ -1690,29 +2186,20 @@ function toFormData(obj, formData, options) {
1690
2186
  // eslint-disable-next-line no-param-reassign
1691
2187
  formData = formData || new (FormData)();
1692
2188
 
1693
- // eslint-disable-next-line no-param-reassign
1694
- options = utils$1.toFlatObject(
1695
- options,
1696
- {
1697
- metaTokens: true,
1698
- dots: false,
1699
- indexes: false,
1700
- },
1701
- false,
1702
- function defined(option, source) {
1703
- // eslint-disable-next-line no-eq-null,eqeqeq
1704
- return !utils$1.isUndefined(source[option]);
1705
- }
1706
- );
2189
+ const option = (name, fallback) => {
2190
+ const value = utils$1.getSafeProp(options, name);
2191
+ return utils$1.isUndefined(value) ? fallback : value;
2192
+ };
1707
2193
 
1708
- const metaTokens = options.metaTokens;
2194
+ const metaTokens = option('metaTokens', true);
1709
2195
  // eslint-disable-next-line no-use-before-define
1710
- const visitor = options.visitor || defaultVisitor;
1711
- const dots = options.dots;
1712
- const indexes = options.indexes;
1713
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1714
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
2196
+ const visitor = option('visitor') || defaultVisitor;
2197
+ const dots = option('dots', false);
2198
+ const indexes = option('indexes', false);
2199
+ const _Blob = option('Blob') || (typeof Blob !== 'undefined' && Blob);
2200
+ const maxDepth = option('maxDepth', DEFAULT_FORM_DATA_MAX_DEPTH);
1715
2201
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2202
+ const stack = [];
1716
2203
 
1717
2204
  if (!utils$1.isFunction(visitor)) {
1718
2205
  throw new TypeError('visitor must be a function');
@@ -1734,24 +2221,62 @@ function toFormData(obj, formData, options) {
1734
2221
  }
1735
2222
 
1736
2223
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1737
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2224
+ if (useBlob && typeof _Blob === 'function') {
2225
+ return new _Blob([value]);
2226
+ }
2227
+ throw new AxiosError(
2228
+ 'Blob is not supported. Use a Buffer instead.',
2229
+ AxiosError.ERR_NOT_SUPPORT
2230
+ );
1738
2231
  }
1739
2232
 
1740
2233
  return value;
1741
2234
  }
1742
2235
 
1743
- /**
1744
- * Default visitor.
1745
- *
1746
- * @param {*} value
1747
- * @param {String|Number} key
1748
- * @param {Array<String|Number>} path
1749
- * @this {FormData}
1750
- *
1751
- * @returns {boolean} return true to visit the each prop of the value recursively
1752
- */
1753
- function defaultVisitor(value, key, path) {
1754
- let arr = value;
2236
+ function throwIfMaxDepthExceeded(depth) {
2237
+ if (depth > maxDepth) {
2238
+ throw new AxiosError(
2239
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
2240
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
2241
+ );
2242
+ }
2243
+ }
2244
+
2245
+ function stringifyWithDepthLimit(value, depth) {
2246
+ if (maxDepth === Infinity) {
2247
+ return JSON.stringify(value);
2248
+ }
2249
+
2250
+ const ancestors = [];
2251
+
2252
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
2253
+ if (!utils$1.isObject(currentValue)) {
2254
+ return currentValue;
2255
+ }
2256
+
2257
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
2258
+ ancestors.pop();
2259
+ }
2260
+
2261
+ ancestors.push(currentValue);
2262
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
2263
+
2264
+ return currentValue;
2265
+ });
2266
+ }
2267
+
2268
+ /**
2269
+ * Default visitor.
2270
+ *
2271
+ * @param {*} value
2272
+ * @param {String|Number} key
2273
+ * @param {Array<String|Number>} path
2274
+ * @this {FormData}
2275
+ *
2276
+ * @returns {boolean} return true to visit the each prop of the value recursively
2277
+ */
2278
+ function defaultVisitor(value, key, path) {
2279
+ let arr = value;
1755
2280
 
1756
2281
  if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1757
2282
  formData.append(renderKey(path, key, dots), convertValue(value));
@@ -1763,7 +2288,7 @@ function toFormData(obj, formData, options) {
1763
2288
  // eslint-disable-next-line no-param-reassign
1764
2289
  key = metaTokens ? key : key.slice(0, -2);
1765
2290
  // eslint-disable-next-line no-param-reassign
1766
- value = JSON.stringify(value);
2291
+ value = stringifyWithDepthLimit(value, 1);
1767
2292
  } else if (
1768
2293
  (utils$1.isArray(value) && isFlatArray(value)) ||
1769
2294
  ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
@@ -1796,8 +2321,6 @@ function toFormData(obj, formData, options) {
1796
2321
  return false;
1797
2322
  }
1798
2323
 
1799
- const stack = [];
1800
-
1801
2324
  const exposedHelpers = Object.assign(predicates, {
1802
2325
  defaultVisitor,
1803
2326
  convertValue,
@@ -1807,12 +2330,7 @@ function toFormData(obj, formData, options) {
1807
2330
  function build(value, path, depth = 0) {
1808
2331
  if (utils$1.isUndefined(value)) return;
1809
2332
 
1810
- if (depth > maxDepth) {
1811
- throw new AxiosError(
1812
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1813
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
1814
- );
1815
- }
2333
+ throwIfMaxDepthExceeded(depth);
1816
2334
 
1817
2335
  if (stack.indexOf(value) !== -1) {
1818
2336
  throw new Error('Circular reference detected in ' + path.join('.'));
@@ -1886,9 +2404,7 @@ prototype.append = function append(name, value) {
1886
2404
 
1887
2405
  prototype.toString = function toString(encoder) {
1888
2406
  const _encode = encoder
1889
- ? function (value) {
1890
- return encoder.call(this, value, encode$1);
1891
- }
2407
+ ? (value) => encoder.call(this, value, encode$1)
1892
2408
  : encode$1;
1893
2409
 
1894
2410
  return this._pairs
@@ -1927,8 +2443,7 @@ function buildURL(url, params, options) {
1927
2443
  if (!params) {
1928
2444
  return url;
1929
2445
  }
1930
-
1931
- const _encode = (options && options.encode) || encode;
2446
+ url = url || '';
1932
2447
 
1933
2448
  const _options = utils$1.isFunction(options)
1934
2449
  ? {
@@ -1936,7 +2451,11 @@ function buildURL(url, params, options) {
1936
2451
  }
1937
2452
  : options;
1938
2453
 
1939
- const serializeFn = _options && _options.serialize;
2454
+ // Read serializer options pollution-safely: own properties and methods on a
2455
+ // class/template prototype are honored, but values injected onto a polluted
2456
+ // Object.prototype are ignored.
2457
+ const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
2458
+ const serializeFn = utils$1.getSafeProp(_options, 'serialize');
1940
2459
 
1941
2460
  let serializedParams;
1942
2461
 
@@ -1960,9 +2479,67 @@ function buildURL(url, params, options) {
1960
2479
  return url;
1961
2480
  }
1962
2481
 
2482
+ const $internals = Symbol('internals');
2483
+
2484
+ // `handlers` is public and may be replaced with a nullish value by user code;
2485
+ // `clear()` has always tolerated that. Treat it as an empty stack rather than
2486
+ // dereferencing it.
2487
+ function countHandlers(handlers) {
2488
+ return handlers ? handlers.length : 0;
2489
+ }
2490
+
2491
+ function trimHandlers(handlers) {
2492
+ if (!handlers) {
2493
+ return;
2494
+ }
2495
+
2496
+ while (handlers.length && handlers[handlers.length - 1] === null) {
2497
+ handlers.pop();
2498
+ }
2499
+ }
2500
+
2501
+ // Preserve the array-key coercion used before IDs were stored in a Map, without
2502
+ // treating null, empty strings, or noncanonical numeric strings as ID zero.
2503
+ function normalizeHandlerId(id) {
2504
+ if (typeof id === 'string' && id !== '' && String(Number(id)) === id) {
2505
+ return Number(id);
2506
+ }
2507
+
2508
+ return id;
2509
+ }
2510
+
2511
+ function syncHandlerEntries(manager, internals) {
2512
+ const handlers = manager.handlers;
2513
+ const length = countHandlers(handlers);
2514
+
2515
+ if (handlers !== internals.handlersRef) {
2516
+ internals.handlersRef = handlers;
2517
+ internals.handlerEntries.clear();
2518
+ } else if (length !== internals.handlersLength) {
2519
+ if (!length) {
2520
+ internals.handlerEntries.clear();
2521
+ } else {
2522
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
2523
+ if (handlers[entry.index] !== entry.handler) {
2524
+ internals.handlerEntries.delete(id);
2525
+ }
2526
+ });
2527
+ }
2528
+ }
2529
+
2530
+ internals.handlersLength = length;
2531
+ }
2532
+
1963
2533
  class InterceptorManager {
1964
2534
  constructor() {
1965
2535
  this.handlers = [];
2536
+ this[$internals] = {
2537
+ handlersRef: this.handlers,
2538
+ handlersLength: this.handlers.length,
2539
+ handlerEntries: new Map(),
2540
+ iterationDepth: 0,
2541
+ nextId: 0,
2542
+ };
1966
2543
  }
1967
2544
 
1968
2545
  /**
@@ -1975,13 +2552,30 @@ class InterceptorManager {
1975
2552
  * @return {Number} An ID used to remove interceptor later
1976
2553
  */
1977
2554
  use(fulfilled, rejected, options) {
1978
- this.handlers.push({
2555
+ const handler = {
1979
2556
  fulfilled,
1980
2557
  rejected,
1981
2558
  synchronous: options ? options.synchronous : false,
1982
2559
  runWhen: options ? options.runWhen : null,
2560
+ };
2561
+ const internals = this[$internals];
2562
+
2563
+ if (this.handlers == null) {
2564
+ this.handlers = [];
2565
+ }
2566
+
2567
+ syncHandlerEntries(this, internals);
2568
+
2569
+ const id = internals.nextId++;
2570
+
2571
+ this.handlers.push(handler);
2572
+ internals.handlerEntries.set(id, {
2573
+ handler,
2574
+ index: this.handlers.length - 1,
1983
2575
  });
1984
- return this.handlers.length - 1;
2576
+ internals.handlersLength = this.handlers.length;
2577
+
2578
+ return id;
1985
2579
  }
1986
2580
 
1987
2581
  /**
@@ -1992,8 +2586,28 @@ class InterceptorManager {
1992
2586
  * @returns {void}
1993
2587
  */
1994
2588
  eject(id) {
1995
- if (this.handlers[id]) {
1996
- this.handlers[id] = null;
2589
+ const internals = this[$internals];
2590
+
2591
+ syncHandlerEntries(this, internals);
2592
+
2593
+ const handlerId = normalizeHandlerId(id);
2594
+ const entry = internals.handlerEntries.get(handlerId);
2595
+
2596
+ if (entry) {
2597
+ internals.handlerEntries.delete(handlerId);
2598
+
2599
+ // Ignore IDs invalidated by clear or direct replacement of handlers.
2600
+ if (this.handlers[entry.index] !== entry.handler) {
2601
+ return;
2602
+ }
2603
+
2604
+ this.handlers[entry.index] = null;
2605
+
2606
+ // Do not reuse an index while forEach is walking its length snapshot.
2607
+ if (!internals.iterationDepth) {
2608
+ trimHandlers(this.handlers);
2609
+ internals.handlersLength = this.handlers.length;
2610
+ }
1997
2611
  }
1998
2612
  }
1999
2613
 
@@ -2005,6 +2619,7 @@ class InterceptorManager {
2005
2619
  clear() {
2006
2620
  if (this.handlers) {
2007
2621
  this.handlers = [];
2622
+ syncHandlerEntries(this, this[$internals]);
2008
2623
  }
2009
2624
  }
2010
2625
 
@@ -2019,11 +2634,25 @@ class InterceptorManager {
2019
2634
  * @returns {void}
2020
2635
  */
2021
2636
  forEach(fn) {
2022
- utils$1.forEach(this.handlers, function forEachHandler(h) {
2023
- if (h !== null) {
2024
- fn(h);
2637
+ const internals = this[$internals];
2638
+
2639
+ syncHandlerEntries(this, internals);
2640
+
2641
+ internals.iterationDepth++;
2642
+
2643
+ try {
2644
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
2645
+ if (h !== null) {
2646
+ fn(h);
2647
+ }
2648
+ });
2649
+ } finally {
2650
+ if (!--internals.iterationDepth) {
2651
+ syncHandlerEntries(this, internals);
2652
+ trimHandlers(this.handlers);
2653
+ internals.handlersLength = countHandlers(this.handlers);
2025
2654
  }
2026
- });
2655
+ }
2027
2656
  }
2028
2657
  }
2029
2658
 
@@ -2033,6 +2662,8 @@ var transitionalDefaults = {
2033
2662
  clarifyTimeoutError: false,
2034
2663
  legacyInterceptorReqResOrdering: true,
2035
2664
  advertiseZstdAcceptEncoding: false,
2665
+ validateStatusUndefinedResolves: true,
2666
+ encodeBasicAuthUsername: false,
2036
2667
  };
2037
2668
 
2038
2669
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -2124,6 +2755,17 @@ function toURLEncodedForm(data, options) {
2124
2755
  });
2125
2756
  }
2126
2757
 
2758
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
2759
+
2760
+ function throwIfDepthExceeded(index) {
2761
+ if (index > MAX_DEPTH) {
2762
+ throw new AxiosError(
2763
+ 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
2764
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
2765
+ );
2766
+ }
2767
+ }
2768
+
2127
2769
  /**
2128
2770
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2129
2771
  *
@@ -2132,13 +2774,26 @@ function toURLEncodedForm(data, options) {
2132
2774
  * @returns An array of strings.
2133
2775
  */
2134
2776
  function parsePropPath(name) {
2135
- // foo[x][y][z]
2136
- // foo.x.y.z
2137
- // foo-x-y-z
2138
- // foo x y z
2139
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
2140
- return match[0] === '[]' ? '' : match[1] || match[0];
2141
- });
2777
+ // foo[x][y][z] -> ['foo', 'x', 'y', 'z']
2778
+ // foo.x.y.z -> ['foo', 'x', 'y', 'z']
2779
+ // A path is split on `.` and on `[...]` groups. A segment — whether written
2780
+ // in dot notation or captured inside brackets — may contain any character
2781
+ // except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
2782
+ // literal instead of being split (#5402). `.`, `[` and `]` keep their existing
2783
+ // meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
2784
+ // Excluding `[` from the bracket group also makes the match fail fast at the
2785
+ // next `[`, so a malformed name cannot rescan to the end of the string from
2786
+ // every unmatched `[` — parsing stays linear in the length of the name.
2787
+ const path = [];
2788
+ const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
2789
+ let match;
2790
+
2791
+ while ((match = pattern.exec(name)) !== null) {
2792
+ throwIfDepthExceeded(path.length);
2793
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
2794
+ }
2795
+
2796
+ return path;
2142
2797
  }
2143
2798
 
2144
2799
  /**
@@ -2161,6 +2816,29 @@ function arrayToObject(arr) {
2161
2816
  return obj;
2162
2817
  }
2163
2818
 
2819
+ function normalizeArray(value) {
2820
+ if (!utils$1.isArray(value)) return value;
2821
+
2822
+ const keys = Object.keys(value);
2823
+ return keys.length !== value.length || keys.some((key, index) => key !== String(index))
2824
+ ? arrayToObject(value)
2825
+ : value;
2826
+ }
2827
+
2828
+ function normalizeArrays(obj) {
2829
+ const pending = [obj];
2830
+ while (pending.length) {
2831
+ const target = pending.pop();
2832
+ Object.keys(target).forEach((key) => {
2833
+ const value = (target[key] = normalizeArray(target[key]));
2834
+ if (utils$1.isArray(value) || utils$1.isPlainObject(value)) {
2835
+ pending.push(value);
2836
+ }
2837
+ });
2838
+ }
2839
+ return obj;
2840
+ }
2841
+
2164
2842
  /**
2165
2843
  * It takes a FormData object and returns a JavaScript object
2166
2844
  *
@@ -2170,6 +2848,8 @@ function arrayToObject(arr) {
2170
2848
  */
2171
2849
  function formDataToJSON(formData) {
2172
2850
  function buildPath(path, value, target, index) {
2851
+ throwIfDepthExceeded(index);
2852
+
2173
2853
  let name = path[index++];
2174
2854
 
2175
2855
  if (name === '__proto__') return true;
@@ -2180,6 +2860,7 @@ function formDataToJSON(formData) {
2180
2860
 
2181
2861
  if (isLast) {
2182
2862
  if (utils$1.hasOwnProp(target, name)) {
2863
+ target[name] = normalizeArray(target[name]);
2183
2864
  target[name] = utils$1.isArray(target[name])
2184
2865
  ? target[name].concat(value)
2185
2866
  : [target[name], value];
@@ -2210,12 +2891,26 @@ function formDataToJSON(formData) {
2210
2891
  buildPath(parsePropPath(name), value, obj, 0);
2211
2892
  });
2212
2893
 
2213
- return obj;
2894
+ return normalizeArrays(obj);
2214
2895
  }
2215
2896
 
2216
2897
  return null;
2217
2898
  }
2218
2899
 
2900
+ const methodList = Object.freeze([
2901
+ 'get',
2902
+ 'delete',
2903
+ 'head',
2904
+ 'options',
2905
+ 'post',
2906
+ 'put',
2907
+ 'patch',
2908
+ 'purge',
2909
+ 'link',
2910
+ 'unlink',
2911
+ 'query',
2912
+ ]);
2913
+
2219
2914
  const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
2220
2915
 
2221
2916
  /**
@@ -2378,7 +3073,7 @@ const defaults = {
2378
3073
  },
2379
3074
  };
2380
3075
 
2381
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
3076
+ utils$1.forEach(methodList, (method) => {
2382
3077
  defaults.headers[method] = {};
2383
3078
  });
2384
3079
 
@@ -2450,11 +3145,120 @@ function settle(resolve, reject, response) {
2450
3145
  }
2451
3146
  }
2452
3147
 
3148
+ const urlParserControlCharacters = /[\t\n\r]/g;
3149
+
3150
+ /**
3151
+ * Match WHATWG URL preprocessing before checking a URL's protocol.
3152
+ *
3153
+ * @param {string} url
3154
+ *
3155
+ * @returns {string}
3156
+ */
3157
+ function normalizeURLForProtocolCheck(url) {
3158
+ if (typeof url !== 'string') {
3159
+ return url;
3160
+ }
3161
+
3162
+ let start = 0;
3163
+
3164
+ while (start < url.length && url.charCodeAt(start) <= 0x20) {
3165
+ start++;
3166
+ }
3167
+
3168
+ return url.slice(start).replace(urlParserControlCharacters, '');
3169
+ }
3170
+
2453
3171
  function parseProtocol(url) {
2454
3172
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2455
- return (match && match[1]) || '';
3173
+ return (match && match[1].toLowerCase()) || '';
2456
3174
  }
2457
3175
 
3176
+ const decodeCookieValue = (value) => {
3177
+ try {
3178
+ return decodeURIComponent(value);
3179
+ } catch (e) {
3180
+ return value;
3181
+ }
3182
+ };
3183
+
3184
+ var cookies = platform.hasStandardBrowserEnv
3185
+ ? // Standard browser envs support document.cookie
3186
+ {
3187
+ write(name, value, expires, path, domain, secure, sameSite) {
3188
+ if (typeof document === 'undefined') return;
3189
+
3190
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
3191
+
3192
+ if (utils$1.isNumber(expires)) {
3193
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
3194
+ }
3195
+ if (utils$1.isString(path)) {
3196
+ cookie.push(`path=${path}`);
3197
+ }
3198
+ if (utils$1.isString(domain)) {
3199
+ cookie.push(`domain=${domain}`);
3200
+ }
3201
+ if (secure === true) {
3202
+ cookie.push('secure');
3203
+ }
3204
+ if (utils$1.isString(sameSite)) {
3205
+ cookie.push(`SameSite=${sameSite}`);
3206
+ }
3207
+
3208
+ document.cookie = cookie.join('; ');
3209
+ },
3210
+
3211
+ read(name) {
3212
+ if (typeof document === 'undefined') return null;
3213
+ const cookieString = document.cookie;
3214
+ if (!cookieString) return null;
3215
+ // Match name=value by splitting on the semicolon separator instead of building a
3216
+ // RegExp from `name` — interpolating an unescaped string into a RegExp would let
3217
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
3218
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
3219
+ // "; ", so ignore optional whitespace before each cookie name.
3220
+ const cookies = cookieString.split(';');
3221
+ for (let i = 0; i < cookies.length; i++) {
3222
+ const cookie = cookies[i].replace(/^\s+/, '');
3223
+ const eq = cookie.indexOf('=');
3224
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
3225
+ return decodeCookieValue(cookie.slice(eq + 1));
3226
+ }
3227
+ }
3228
+ return null;
3229
+ },
3230
+
3231
+ async readAsync(name) {
3232
+ try {
3233
+ const store = typeof window !== 'undefined' && window.cookieStore;
3234
+ if (store && utils$1.isFunction(store.get)) {
3235
+ const cookie = await store.get(name);
3236
+ // Both APIs expose stored bytes; preserve Axios's existing URI decoding.
3237
+ return cookie ? decodeCookieValue(cookie.value) : null;
3238
+ }
3239
+ } catch (e) {
3240
+ // Restricted or unavailable storage retains the synchronous fallback.
3241
+ }
3242
+
3243
+ return this.read(name);
3244
+ },
3245
+
3246
+ remove(name) {
3247
+ this.write(name, '', Date.now() - 86400000, '/');
3248
+ },
3249
+ }
3250
+ : // Non-standard browser env (web workers, react-native) lack needed support.
3251
+ {
3252
+ write() {},
3253
+ read() {
3254
+ return null;
3255
+ },
3256
+ async readAsync() {
3257
+ return null;
3258
+ },
3259
+ remove() {},
3260
+ };
3261
+
2458
3262
  /**
2459
3263
  * Calculate data maxRate
2460
3264
  * @param {Number} [samplesCount= 10]
@@ -2511,7 +3315,7 @@ function speedometer(samplesCount, min) {
2511
3315
  * Throttle decorator
2512
3316
  * @param {Function} fn
2513
3317
  * @param {Number} freq
2514
- * @return {Function}
3318
+ * @return {Array<Function>}
2515
3319
  */
2516
3320
  function throttle(fn, freq) {
2517
3321
  let timestamp = 0;
@@ -2546,8 +3350,9 @@ function throttle(fn, freq) {
2546
3350
  };
2547
3351
 
2548
3352
  const flush = () => lastArgs && invoke(lastArgs);
3353
+ const flushWith = (...args) => invoke(args);
2549
3354
 
2550
- return [throttled, flush];
3355
+ return [throttled, flush, flushWith];
2551
3356
  }
2552
3357
 
2553
3358
  const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
@@ -2555,12 +3360,12 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2555
3360
  const _speedometer = speedometer(50, 250);
2556
3361
 
2557
3362
  return throttle((e) => {
2558
- if (!e || typeof e.loaded !== 'number') {
3363
+ if (!e || !utils$1.isNumber(e.loaded)) {
2559
3364
  return;
2560
3365
  }
2561
3366
  const rawLoaded = e.loaded;
2562
3367
  const total = e.lengthComputable ? e.total : undefined;
2563
- const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
3368
+ const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
2564
3369
  const progressBytes = Math.max(0, loaded - bytesNotified);
2565
3370
  const rate = _speedometer(progressBytes);
2566
3371
 
@@ -2597,83 +3402,20 @@ const progressEventDecorator = (total, throttled) => {
2597
3402
  };
2598
3403
 
2599
3404
  const asyncDecorator =
2600
- (fn) =>
3405
+ (fn, scheduler = utils$1.asap) =>
2601
3406
  (...args) =>
2602
- utils$1.asap(() => fn(...args));
3407
+ scheduler(() => fn(...args));
2603
3408
 
2604
3409
  var isURLSameOrigin = platform.hasStandardBrowserEnv
2605
- ? ((origin, isMSIE) => (url) => {
2606
- url = new URL(url, platform.origin);
3410
+ ? ((origin) => (url) => {
3411
+ url = new URL(url, document.baseURI || platform.origin);
2607
3412
 
2608
3413
  return (
2609
- origin.protocol === url.protocol &&
2610
- origin.host === url.host &&
2611
- (isMSIE || origin.port === url.port)
3414
+ origin.protocol === url.protocol && origin.host === url.host && origin.port === url.port
2612
3415
  );
2613
- })(
2614
- new URL(platform.origin),
2615
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
2616
- )
3416
+ })(new URL(platform.origin))
2617
3417
  : () => true;
2618
3418
 
2619
- var cookies = platform.hasStandardBrowserEnv
2620
- ? // Standard browser envs support document.cookie
2621
- {
2622
- write(name, value, expires, path, domain, secure, sameSite) {
2623
- if (typeof document === 'undefined') return;
2624
-
2625
- const cookie = [`${name}=${encodeURIComponent(value)}`];
2626
-
2627
- if (utils$1.isNumber(expires)) {
2628
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
2629
- }
2630
- if (utils$1.isString(path)) {
2631
- cookie.push(`path=${path}`);
2632
- }
2633
- if (utils$1.isString(domain)) {
2634
- cookie.push(`domain=${domain}`);
2635
- }
2636
- if (secure === true) {
2637
- cookie.push('secure');
2638
- }
2639
- if (utils$1.isString(sameSite)) {
2640
- cookie.push(`SameSite=${sameSite}`);
2641
- }
2642
-
2643
- document.cookie = cookie.join('; ');
2644
- },
2645
-
2646
- read(name) {
2647
- if (typeof document === 'undefined') return null;
2648
- // Match name=value by splitting on the semicolon separator instead of building a
2649
- // RegExp from `name` — interpolating an unescaped string into a RegExp would let
2650
- // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
2651
- // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
2652
- // "; ", so ignore optional whitespace before each cookie name.
2653
- const cookies = document.cookie.split(';');
2654
- for (let i = 0; i < cookies.length; i++) {
2655
- const cookie = cookies[i].replace(/^\s+/, '');
2656
- const eq = cookie.indexOf('=');
2657
- if (eq !== -1 && cookie.slice(0, eq) === name) {
2658
- return decodeURIComponent(cookie.slice(eq + 1));
2659
- }
2660
- }
2661
- return null;
2662
- },
2663
-
2664
- remove(name) {
2665
- this.write(name, '', Date.now() - 86400000, '/');
2666
- },
2667
- }
2668
- : // Non-standard browser env (web workers, react-native) lack needed support.
2669
- {
2670
- write() {},
2671
- read() {
2672
- return null;
2673
- },
2674
- remove() {},
2675
- };
2676
-
2677
3419
  /**
2678
3420
  * Determines whether the specified URL is absolute
2679
3421
  *
@@ -2701,9 +3443,67 @@ function isAbsoluteURL(url) {
2701
3443
  * @returns {string} The combined URL
2702
3444
  */
2703
3445
  function combineURLs(baseURL, relativeURL) {
2704
- return relativeURL
2705
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2706
- : baseURL;
3446
+ if (!relativeURL) {
3447
+ return baseURL;
3448
+ }
3449
+
3450
+ let end = baseURL.length;
3451
+
3452
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
3453
+ end--;
3454
+ }
3455
+
3456
+ return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
3457
+ }
3458
+
3459
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
3460
+
3461
+ // Redact the parts of a URL that can carry secrets before it is embedded in an
3462
+ // error message. AxiosError.toJSON() serializes `message` verbatim and errors
3463
+ // are commonly logged, while the opt-in `config.redact` model only cleans
3464
+ // config keys — it cannot reach the message. Redact only the genuinely
3465
+ // sensitive substrings — userinfo (credentials), query parameter values and
3466
+ // fragment contents — with the same REDACTED marker the config redaction uses,
3467
+ // while keeping the scheme, host, path and parameter names so the offending
3468
+ // request stays accurately identifiable.
3469
+ function redactFragment(fragment) {
3470
+ if (!fragment) {
3471
+ return fragment;
3472
+ }
3473
+
3474
+ return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {
3475
+ return `${separator}${parameterName}${REDACTED}`;
3476
+ });
3477
+ }
3478
+
3479
+ function redactSensitiveURLParts(url) {
3480
+ const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
3481
+ const fragmentIndex = redactedURL.indexOf('#');
3482
+ const urlWithoutFragment =
3483
+ fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
3484
+ const redactedURLWithoutFragment = urlWithoutFragment.replace(
3485
+ /([?&][^=&#]*=)[^&#]*/g,
3486
+ `$1${REDACTED}`
3487
+ );
3488
+
3489
+ if (fragmentIndex === -1) {
3490
+ return redactedURLWithoutFragment;
3491
+ }
3492
+
3493
+ return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
3494
+ }
3495
+
3496
+ function assertValidHttpProtocolURL(url, config) {
3497
+ if (typeof url === 'string') {
3498
+ const normalizedURL = normalizeURLForProtocolCheck(url);
3499
+ if (malformedHttpProtocol.test(normalizedURL)) {
3500
+ throw new AxiosError(
3501
+ `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
3502
+ AxiosError.ERR_INVALID_URL,
3503
+ config
3504
+ );
3505
+ }
3506
+ }
2707
3507
  }
2708
3508
 
2709
3509
  /**
@@ -2716,16 +3516,244 @@ function combineURLs(baseURL, relativeURL) {
2716
3516
  *
2717
3517
  * @returns {string} The combined full path
2718
3518
  */
2719
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
3519
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
3520
+ assertValidHttpProtocolURL(requestedURL, config);
2720
3521
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2721
3522
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
3523
+ assertValidHttpProtocolURL(baseURL, config);
2722
3524
  return combineURLs(baseURL, requestedURL);
2723
3525
  }
2724
3526
  return requestedURL;
2725
3527
  }
2726
3528
 
3529
+ function assertParamsAcyclic(params) {
3530
+ const pending = [{ value: params }];
3531
+ const active = new WeakSet();
3532
+ const visited = new WeakSet();
3533
+
3534
+ while (pending.length) {
3535
+ const { value, done } = pending.pop();
3536
+ if (!utils$1.isPlainObject(value) && !utils$1.isArray(value)) continue;
3537
+ if (done) {
3538
+ active.delete(value);
3539
+ continue;
3540
+ }
3541
+ if (active.has(value)) {
3542
+ throw new AxiosError(
3543
+ 'Circular reference detected in params',
3544
+ AxiosError.ERR_BAD_OPTION_VALUE
3545
+ );
3546
+ }
3547
+ if (visited.has(value)) continue;
3548
+ visited.add(value);
3549
+ active.add(value);
3550
+ pending.push({ value, done: true });
3551
+
3552
+ const keys = Object.keys(value);
3553
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
3554
+ Object.getOwnPropertySymbols(value).forEach((key) => {
3555
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
3556
+ if (descriptor && descriptor.enumerable) keys.push(key);
3557
+ });
3558
+ }
3559
+ // Shallow array elements retain fields filtered during plain-object merges.
3560
+ // Inspect reserved data properties without evaluating their accessors.
3561
+ keys.forEach((key) => {
3562
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
3563
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
3564
+ if (descriptor && utils$1.hasOwnProp(descriptor, 'value')) {
3565
+ pending.push({ value: descriptor.value });
3566
+ }
3567
+ } else {
3568
+ pending.push({ value: value[key] });
3569
+ }
3570
+ });
3571
+ }
3572
+ }
3573
+
2727
3574
  const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);
2728
3575
 
3576
+ const ownEnumerableKeys = (thing) => {
3577
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
3578
+ return Object.keys(thing).concat(
3579
+ Object.getOwnPropertySymbols(thing).filter((symbol) => {
3580
+ const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
3581
+ return descriptor && descriptor.enumerable;
3582
+ })
3583
+ );
3584
+ }
3585
+ return Object.keys(thing);
3586
+ };
3587
+
3588
+ // Copy params without recursive merges so the serializer remains responsible
3589
+ // for its depth policy. Only visit defaults that contribute to the result.
3590
+ function mergeParams(a, b) {
3591
+ const pending = [];
3592
+ const copies = new WeakMap();
3593
+ const empty = {};
3594
+
3595
+ function copy(target, source) {
3596
+ if (!utils$1.isPlainObject(source)) {
3597
+ return utils$1.isArray(source) ? source.slice() : source;
3598
+ }
3599
+
3600
+ const base = utils$1.isPlainObject(target) ? target : empty;
3601
+ let bases = copies.get(source);
3602
+ if (!bases) {
3603
+ bases = new WeakMap();
3604
+ copies.set(source, bases);
3605
+ }
3606
+ if (bases.has(base)) return bases.get(base);
3607
+
3608
+ const result = {};
3609
+ bases.set(base, result);
3610
+ pending.push({ base, source, result });
3611
+ return result;
3612
+ }
3613
+
3614
+ const result = utils$1.isUndefined(b) ? copy(undefined, a) : copy(a, b);
3615
+ while (pending.length) {
3616
+ const { base, source, result: target } = pending.pop();
3617
+ const baseKeys = new Set(ownEnumerableKeys(base));
3618
+ const sourceKeys = new Set(ownEnumerableKeys(source));
3619
+ const keys = new Set([...baseKeys, ...sourceKeys]);
3620
+
3621
+ keys.forEach((key) => {
3622
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') return;
3623
+ const hasSource = sourceKeys.has(key);
3624
+ const value = hasSource ? source[key] : undefined;
3625
+ const previous =
3626
+ (!hasSource || utils$1.isPlainObject(value)) && baseKeys.has(key) ? base[key] : undefined;
3627
+ target[key] = hasSource ? copy(previous, value) : copy(undefined, previous);
3628
+ });
3629
+ }
3630
+
3631
+ assertParamsAcyclic(result);
3632
+ return result;
3633
+ }
3634
+
3635
+ function getMergedValue(target, source, prop, caseless) {
3636
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3637
+ return utils$1.merge.call({ caseless }, target, source);
3638
+ } else if (utils$1.isPlainObject(source)) {
3639
+ return utils$1.merge({}, source);
3640
+ } else if (utils$1.isArray(source)) {
3641
+ return source.slice();
3642
+ }
3643
+ return source;
3644
+ }
3645
+
3646
+ function mergeDeepProperties(a, b, prop, caseless) {
3647
+ if (!utils$1.isUndefined(b)) {
3648
+ return getMergedValue(a, b, prop, caseless);
3649
+ } else if (!utils$1.isUndefined(a)) {
3650
+ return getMergedValue(undefined, a, prop, caseless);
3651
+ }
3652
+ }
3653
+
3654
+ // eslint-disable-next-line consistent-return
3655
+ function valueFromConfig2(a, b) {
3656
+ if (!utils$1.isUndefined(b)) {
3657
+ return getMergedValue(undefined, b);
3658
+ }
3659
+ }
3660
+
3661
+ // eslint-disable-next-line consistent-return
3662
+ function defaultToConfig2(a, b) {
3663
+ if (!utils$1.isUndefined(b)) {
3664
+ return getMergedValue(undefined, b);
3665
+ } else if (!utils$1.isUndefined(a)) {
3666
+ return getMergedValue(undefined, a);
3667
+ }
3668
+ }
3669
+
3670
+ function getMergedTransitionalOption(config1, config2, prop) {
3671
+ const transitional2 = utils$1.hasOwnProp(config2, 'transitional')
3672
+ ? config2.transitional
3673
+ : undefined;
3674
+
3675
+ if (!utils$1.isUndefined(transitional2)) {
3676
+ if (utils$1.isPlainObject(transitional2)) {
3677
+ if (utils$1.hasOwnProp(transitional2, prop)) {
3678
+ return transitional2[prop];
3679
+ }
3680
+ } else {
3681
+ return undefined;
3682
+ }
3683
+ }
3684
+
3685
+ const transitional1 = utils$1.hasOwnProp(config1, 'transitional')
3686
+ ? config1.transitional
3687
+ : undefined;
3688
+
3689
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
3690
+ return transitional1[prop];
3691
+ }
3692
+
3693
+ return undefined;
3694
+ }
3695
+
3696
+ // eslint-disable-next-line consistent-return
3697
+ function mergeDirectKeys(a, b, prop, config1, config2) {
3698
+ if (utils$1.hasOwnProp(config2, prop)) {
3699
+ return getMergedValue(a, b);
3700
+ } else if (utils$1.hasOwnProp(config1, prop)) {
3701
+ return getMergedValue(undefined, a);
3702
+ }
3703
+ }
3704
+
3705
+ function mergeHeaders(a, b, prop) {
3706
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
3707
+ }
3708
+
3709
+ // Null-proto, frozen descriptor so a polluted Object.prototype.get cannot turn
3710
+ // this data descriptor into an accessor descriptor on the way in.
3711
+ // defineProperty only reads it, so one shared instance serves every call.
3712
+ const hasOwnPropertyDescriptor = Object.freeze({
3713
+ __proto__: null,
3714
+ value: Object.prototype.hasOwnProperty,
3715
+ enumerable: false,
3716
+ writable: true,
3717
+ configurable: true,
3718
+ });
3719
+
3720
+ // The strategy table and the strategies above are stateless, so they are
3721
+ // built once at module load instead of on every call: mergeConfig runs at
3722
+ // most twice per request (once from a method alias, once from `_request`).
3723
+ const mergeMap = {
3724
+ url: valueFromConfig2,
3725
+ method: valueFromConfig2,
3726
+ data: valueFromConfig2,
3727
+ baseURL: defaultToConfig2,
3728
+ transformRequest: defaultToConfig2,
3729
+ transformResponse: defaultToConfig2,
3730
+ params: mergeParams,
3731
+ paramsSerializer: defaultToConfig2,
3732
+ timeout: defaultToConfig2,
3733
+ timeoutErrorMessage: defaultToConfig2,
3734
+ withCredentials: defaultToConfig2,
3735
+ withXSRFToken: defaultToConfig2,
3736
+ adapter: defaultToConfig2,
3737
+ responseType: defaultToConfig2,
3738
+ xsrfCookieName: defaultToConfig2,
3739
+ xsrfHeaderName: defaultToConfig2,
3740
+ onUploadProgress: defaultToConfig2,
3741
+ onDownloadProgress: defaultToConfig2,
3742
+ decompress: defaultToConfig2,
3743
+ maxContentLength: defaultToConfig2,
3744
+ maxBodyLength: defaultToConfig2,
3745
+ beforeRedirect: defaultToConfig2,
3746
+ transport: defaultToConfig2,
3747
+ httpAgent: defaultToConfig2,
3748
+ httpsAgent: defaultToConfig2,
3749
+ cancelToken: defaultToConfig2,
3750
+ socketPath: defaultToConfig2,
3751
+ allowedSocketPaths: defaultToConfig2,
3752
+ responseEncoding: defaultToConfig2,
3753
+ validateStatus: mergeDirectKeys,
3754
+ headers: mergeHeaders,
3755
+ };
3756
+
2729
3757
  /**
2730
3758
  * Config-specific merge-function which creates a new config-object
2731
3759
  * by merging two configuration objects together.
@@ -2737,6 +3765,7 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing }
2737
3765
  */
2738
3766
  function mergeConfig(config1, config2) {
2739
3767
  // eslint-disable-next-line no-param-reassign
3768
+ config1 = config1 || {};
2740
3769
  config2 = config2 || {};
2741
3770
 
2742
3771
  // Use a null-prototype object so that downstream reads such as `config.auth`
@@ -2744,115 +3773,56 @@ function mergeConfig(config1, config2) {
2744
3773
  // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
2745
3774
  // ergonomics for user code that relies on it.
2746
3775
  const config = Object.create(null);
2747
- Object.defineProperty(config, 'hasOwnProperty', {
2748
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2749
- // this data descriptor into an accessor descriptor on the way in.
2750
- __proto__: null,
2751
- value: Object.prototype.hasOwnProperty,
2752
- enumerable: false,
2753
- writable: true,
2754
- configurable: true,
2755
- });
2756
-
2757
- function getMergedValue(target, source, prop, caseless) {
2758
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2759
- return utils$1.merge.call({ caseless }, target, source);
2760
- } else if (utils$1.isPlainObject(source)) {
2761
- return utils$1.merge({}, source);
2762
- } else if (utils$1.isArray(source)) {
2763
- return source.slice();
2764
- }
2765
- return source;
2766
- }
3776
+ Object.defineProperty(config, 'hasOwnProperty', hasOwnPropertyDescriptor);
2767
3777
 
2768
- function mergeDeepProperties(a, b, prop, caseless) {
2769
- if (!utils$1.isUndefined(b)) {
2770
- return getMergedValue(a, b, prop, caseless);
2771
- } else if (!utils$1.isUndefined(a)) {
2772
- return getMergedValue(undefined, a, prop, caseless);
2773
- }
2774
- }
2775
-
2776
- // eslint-disable-next-line consistent-return
2777
- function valueFromConfig2(a, b) {
2778
- if (!utils$1.isUndefined(b)) {
2779
- return getMergedValue(undefined, b);
2780
- }
2781
- }
2782
-
2783
- // eslint-disable-next-line consistent-return
2784
- function defaultToConfig2(a, b) {
2785
- if (!utils$1.isUndefined(b)) {
2786
- return getMergedValue(undefined, b);
2787
- } else if (!utils$1.isUndefined(a)) {
2788
- return getMergedValue(undefined, a);
2789
- }
2790
- }
2791
-
2792
- // eslint-disable-next-line consistent-return
2793
- function mergeDirectKeys(a, b, prop) {
2794
- if (utils$1.hasOwnProp(config2, prop)) {
2795
- return getMergedValue(a, b);
2796
- } else if (utils$1.hasOwnProp(config1, prop)) {
2797
- return getMergedValue(undefined, a);
2798
- }
2799
- }
2800
-
2801
- const mergeMap = {
2802
- url: valueFromConfig2,
2803
- method: valueFromConfig2,
2804
- data: valueFromConfig2,
2805
- baseURL: defaultToConfig2,
2806
- transformRequest: defaultToConfig2,
2807
- transformResponse: defaultToConfig2,
2808
- paramsSerializer: defaultToConfig2,
2809
- timeout: defaultToConfig2,
2810
- timeoutMessage: defaultToConfig2,
2811
- withCredentials: defaultToConfig2,
2812
- withXSRFToken: defaultToConfig2,
2813
- adapter: defaultToConfig2,
2814
- responseType: defaultToConfig2,
2815
- xsrfCookieName: defaultToConfig2,
2816
- xsrfHeaderName: defaultToConfig2,
2817
- onUploadProgress: defaultToConfig2,
2818
- onDownloadProgress: defaultToConfig2,
2819
- decompress: defaultToConfig2,
2820
- maxContentLength: defaultToConfig2,
2821
- maxBodyLength: defaultToConfig2,
2822
- beforeRedirect: defaultToConfig2,
2823
- transport: defaultToConfig2,
2824
- httpAgent: defaultToConfig2,
2825
- httpsAgent: defaultToConfig2,
2826
- cancelToken: defaultToConfig2,
2827
- socketPath: defaultToConfig2,
2828
- allowedSocketPaths: defaultToConfig2,
2829
- responseEncoding: defaultToConfig2,
2830
- validateStatus: mergeDirectKeys,
2831
- headers: (a, b, prop) =>
2832
- mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
2833
- };
3778
+ const keys = ownEnumerableKeys({ ...config1, ...config2 });
2834
3779
 
2835
- utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2836
- if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
3780
+ for (let i = 0, len = keys.length; i < len; i++) {
3781
+ const prop = keys[i];
3782
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') continue;
2837
3783
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2838
3784
  const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
2839
3785
  const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
2840
- const configValue = merge(a, b, prop);
3786
+ const configValue =
3787
+ merge === mergeDirectKeys ? merge(a, b, prop, config1, config2) : merge(a, b, prop);
2841
3788
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2842
- });
3789
+ }
3790
+
3791
+ if (
3792
+ utils$1.hasOwnProp(config2, 'validateStatus') &&
3793
+ utils$1.isUndefined(config2.validateStatus) &&
3794
+ getMergedTransitionalOption(config1, config2, 'validateStatusUndefinedResolves') === false
3795
+ ) {
3796
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
3797
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
3798
+ } else {
3799
+ delete config.validateStatus;
3800
+ }
3801
+ }
2843
3802
 
2844
3803
  return config;
2845
3804
  }
2846
3805
 
2847
3806
  const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
2848
3807
 
3808
+ /**
3809
+ * Apply the headers generated by a FormData implementation to the request headers,
3810
+ * honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
3811
+ * content-* headers; otherwise merge all of them.
3812
+ *
3813
+ * @param {AxiosHeaders} headers - the request headers to mutate
3814
+ * @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
3815
+ * @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
3816
+ *
3817
+ * @returns {void}
3818
+ */
2849
3819
  function setFormDataHeaders(headers, formHeaders, policy) {
2850
3820
  if (policy !== 'content-only') {
2851
3821
  headers.set(formHeaders);
2852
3822
  return;
2853
3823
  }
2854
3824
 
2855
- Object.entries(formHeaders).forEach(([key, val]) => {
3825
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
2856
3826
  if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2857
3827
  headers.set(key, val);
2858
3828
  }
@@ -2872,7 +3842,9 @@ const encodeUTF8$1 = (str) =>
2872
3842
  String.fromCharCode(parseInt(hex, 16))
2873
3843
  );
2874
3844
 
2875
- function resolveConfig(config) {
3845
+ const readCookie = (name) => cookies.read(name);
3846
+
3847
+ function resolveConfig(config, readXsrfCookie = readCookie) {
2876
3848
  const newConfig = mergeConfig({}, config);
2877
3849
 
2878
3850
  // Read only own properties to prevent prototype pollution gadgets
@@ -2892,30 +3864,49 @@ function resolveConfig(config) {
2892
3864
  newConfig.headers = headers = AxiosHeaders.from(headers);
2893
3865
 
2894
3866
  newConfig.url = buildURL(
2895
- buildFullPath(baseURL, url, allowAbsoluteUrls),
3867
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
2896
3868
  own('params'),
2897
3869
  own('paramsSerializer')
2898
3870
  );
2899
3871
 
2900
3872
  // HTTP basic authentication
2901
3873
  if (auth) {
2902
- headers.set(
2903
- 'Authorization',
2904
- 'Basic ' +
2905
- btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8$1(auth.password) : ''))
2906
- );
3874
+ const username = utils$1.getSafeProp(auth, 'username') || '';
3875
+ const password = utils$1.getSafeProp(auth, 'password') || '';
3876
+ const transitional = own('transitional');
3877
+ const encodeUsername =
3878
+ transitional &&
3879
+ utils$1.hasOwnProp(transitional, 'encodeBasicAuthUsername') &&
3880
+ transitional.encodeBasicAuthUsername === true;
3881
+
3882
+ try {
3883
+ headers.set(
3884
+ 'Authorization',
3885
+ // Preserve legacy username bytes unless the caller opts in to UTF-8.
3886
+ 'Basic ' +
3887
+ btoa(
3888
+ (encodeUsername ? encodeUTF8$1(username) : username) +
3889
+ ':' +
3890
+ (password ? encodeUTF8$1(password) : '')
3891
+ )
3892
+ );
3893
+ } catch (e) {
3894
+ throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
3895
+ }
2907
3896
  }
2908
3897
 
2909
3898
  if (utils$1.isFormData(data)) {
3899
+ const getHeaders = utils$1.getSafeProp(data, 'getHeaders');
3900
+
2910
3901
  if (
2911
3902
  platform.hasStandardBrowserEnv ||
2912
3903
  platform.hasStandardBrowserWebWorkerEnv ||
2913
3904
  utils$1.isReactNative(data)
2914
3905
  ) {
2915
3906
  headers.setContentType(undefined); // browser/web worker/RN handles it
2916
- } else if (utils$1.isFunction(data.getHeaders)) {
3907
+ } else if (utils$1.isFunction(getHeaders)) {
2917
3908
  // Node.js FormData (like form-data package)
2918
- setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
3909
+ setFormDataHeaders(headers, getHeaders.call(data), own('formDataHeaderPolicy'));
2919
3910
  }
2920
3911
  }
2921
3912
 
@@ -2935,7 +3926,7 @@ function resolveConfig(config) {
2935
3926
  withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
2936
3927
 
2937
3928
  if (shouldSendXSRF) {
2938
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
3929
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
2939
3930
 
2940
3931
  if (xsrfValue) {
2941
3932
  headers.set(xsrfHeaderName, xsrfValue);
@@ -2951,17 +3942,60 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2951
3942
  var xhrAdapter = isXHRAdapterSupported &&
2952
3943
  function (config) {
2953
3944
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2954
- const _config = resolveConfig(config);
3945
+ let useAsyncXsrf;
3946
+ try {
3947
+ const store =
3948
+ platform.hasStandardBrowserEnv && typeof window !== 'undefined' && window.cookieStore;
3949
+ useAsyncXsrf = store && utils$1.isFunction(store.get);
3950
+ } catch (e) {
3951
+ // A restricted Cookie Store getter must retain the synchronous fallback.
3952
+ }
3953
+ let xsrfCookieName;
3954
+ const _config = resolveConfig(
3955
+ config,
3956
+ useAsyncXsrf
3957
+ ? (name) => {
3958
+ xsrfCookieName = name;
3959
+ return null;
3960
+ }
3961
+ : undefined
3962
+ );
2955
3963
  let requestData = _config.data;
2956
3964
  const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
2957
3965
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
2958
3966
  let onCanceled;
3967
+ let timeoutId;
2959
3968
  let uploadThrottled, downloadThrottled;
2960
- let flushUpload, flushDownload;
3969
+ let flushUpload, flushDownload, flushDownloadWithEvent;
2961
3970
 
2962
3971
  function done() {
2963
- flushUpload && flushUpload(); // flush events
2964
- flushDownload && flushDownload(); // flush events
3972
+ clearTimeout(timeoutId);
3973
+ // A final progress callback must not prevent the remaining cleanup.
3974
+ // Report errors asynchronously, as onloadend and the throttle timer do.
3975
+ try {
3976
+ flushUpload && flushUpload(); // flush events
3977
+ } catch (err) {
3978
+ setTimeout(() => {
3979
+ throw err;
3980
+ });
3981
+ }
3982
+ try {
3983
+ flushDownload && flushDownload(); // flush events
3984
+ } catch (err) {
3985
+ setTimeout(() => {
3986
+ throw err;
3987
+ });
3988
+ }
3989
+
3990
+ // A flush can synchronously cancel the request and reenter done().
3991
+ // In that case the inner call has already detached these listeners.
3992
+ if (request) {
3993
+ downloadThrottled && request.removeEventListener('progress', downloadThrottled);
3994
+ if (request.upload) {
3995
+ uploadThrottled && request.upload.removeEventListener('progress', uploadThrottled);
3996
+ flushUpload && request.upload.removeEventListener('loadend', flushUpload);
3997
+ }
3998
+ }
2965
3999
 
2966
4000
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2967
4001
 
@@ -2975,10 +4009,55 @@ var xhrAdapter = isXHRAdapterSupported &&
2975
4009
  // Set the request timeout in MS
2976
4010
  request.timeout = _config.timeout;
2977
4011
 
2978
- function onloadend() {
4012
+ function onloadend(event) {
4013
+ if (!request) {
4014
+ return;
4015
+ }
4016
+
4017
+ // Status 0 means no response was received, which onerror and onabort normally
4018
+ // reject before this runs. Firefox 152 fires only readystatechange and loadend for
4019
+ // navigation-canceled requests (https://bugzilla.mozilla.org/show_bug.cgi?id=1505389),
4020
+ // leaving settle() to resolve them as an empty success. ECONNABORTED is the error
4021
+ // onabort raised on Firefox 151. Reads over file:, which some environments report as
4022
+ // status 0 on success, are excluded by the request URL's scheme after browser-style
4023
+ // preprocessing, by the page origin's scheme for relative URLs (which inherit it), or
4024
+ // by responseURL where implemented.
4025
+ if (
4026
+ request.status === 0 &&
4027
+ (parseProtocol(normalizeURLForProtocolCheck(_config.url)) ||
4028
+ parseProtocol(platform.origin)) !== 'file' &&
4029
+ !(request.responseURL && request.responseURL.startsWith('file:'))
4030
+ ) {
4031
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
4032
+ done();
4033
+
4034
+ // Clean up request
4035
+ request = null;
4036
+ return;
4037
+ }
4038
+
4039
+ // When loadend is still dispatching, flushing with it gives progress
4040
+ // listeners a final delivery whose event has a live target. The legacy
4041
+ // ready-state fallback has no event, so replay its pending progress.
4042
+ // A throwing listener must not block settlement; rethrow asynchronously,
4043
+ // matching how listener errors surface on the throttle timer path.
4044
+ try {
4045
+ if (event) {
4046
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
4047
+ } else {
4048
+ flushDownload && flushDownload();
4049
+ }
4050
+ } catch (err) {
4051
+ setTimeout(() => {
4052
+ throw err;
4053
+ });
4054
+ }
4055
+
4056
+ // A final progress callback can cancel the request synchronously.
2979
4057
  if (!request) {
2980
4058
  return;
2981
4059
  }
4060
+
2982
4061
  // Prepare the response
2983
4062
  const responseHeaders = AxiosHeaders.from(
2984
4063
  'getAllResponseHeaders' in request && request.getAllResponseHeaders()
@@ -3067,6 +4146,7 @@ var xhrAdapter = isXHRAdapterSupported &&
3067
4146
 
3068
4147
  // Handle timeout
3069
4148
  request.ontimeout = function handleTimeout() {
4149
+ if (!request) return;
3070
4150
  let timeoutErrorMessage = _config.timeout
3071
4151
  ? 'timeout of ' + _config.timeout + 'ms exceeded'
3072
4152
  : 'timeout exceeded';
@@ -3091,13 +4171,6 @@ var xhrAdapter = isXHRAdapterSupported &&
3091
4171
  // Remove Content-Type if data is undefined
3092
4172
  requestData === undefined && requestHeaders.setContentType(null);
3093
4173
 
3094
- // Add headers to the request
3095
- if ('setRequestHeader' in request) {
3096
- utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
3097
- request.setRequestHeader(key, val);
3098
- });
3099
- }
3100
-
3101
4174
  // Add withCredentials to request if needed
3102
4175
  if (!utils$1.isUndefined(_config.withCredentials)) {
3103
4176
  request.withCredentials = !!_config.withCredentials;
@@ -3110,7 +4183,10 @@ var xhrAdapter = isXHRAdapterSupported &&
3110
4183
 
3111
4184
  // Handle progress if needed
3112
4185
  if (onDownloadProgress) {
3113
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
4186
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(
4187
+ onDownloadProgress,
4188
+ true
4189
+ );
3114
4190
  request.addEventListener('progress', downloadThrottled);
3115
4191
  }
3116
4192
 
@@ -3131,12 +4207,14 @@ var xhrAdapter = isXHRAdapterSupported &&
3131
4207
  return;
3132
4208
  }
3133
4209
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3134
- request.abort();
4210
+ const xhr = request;
3135
4211
  done();
3136
4212
  request = null;
4213
+ xhr.abort();
3137
4214
  };
3138
4215
 
3139
4216
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
4217
+ if (!request) return;
3140
4218
  if (_config.signal) {
3141
4219
  _config.signal.aborted
3142
4220
  ? onCanceled()
@@ -3144,6 +4222,8 @@ var xhrAdapter = isXHRAdapterSupported &&
3144
4222
  }
3145
4223
  }
3146
4224
 
4225
+ if (!request) return;
4226
+
3147
4227
  const protocol = parseProtocol(_config.url);
3148
4228
 
3149
4229
  if (protocol && !platform.protocols.includes(protocol)) {
@@ -3154,11 +4234,77 @@ var xhrAdapter = isXHRAdapterSupported &&
3154
4234
  config
3155
4235
  )
3156
4236
  );
4237
+ done();
3157
4238
  return;
3158
4239
  }
3159
4240
 
3160
- // Send the request
3161
- request.send(requestData || null);
4241
+ const sendRequest = () => {
4242
+ if (!request) return;
4243
+ // Apply headers after an asynchronous XSRF read so existing headers are
4244
+ // replaced through AxiosHeaders rather than appended by the native XHR.
4245
+ if ('setRequestHeader' in request) {
4246
+ utils$1.forEach(
4247
+ toByteStringHeaderObject(requestHeaders),
4248
+ function setRequestHeader(val, key) {
4249
+ request.setRequestHeader(key, val);
4250
+ }
4251
+ );
4252
+ }
4253
+ request.send(requestData || null);
4254
+ };
4255
+
4256
+ if (xsrfCookieName) {
4257
+ // Native XHR timeout starts at send(). Cover cookie preparation and the
4258
+ // subsequent request with the same budget and existing timeout handler.
4259
+ const now =
4260
+ typeof performance !== 'undefined' && utils$1.isFunction(performance.now)
4261
+ ? () => performance.now()
4262
+ : Date.now;
4263
+ const deadline = request.timeout > 0 ? now() + Number(request.timeout) : undefined;
4264
+ const abortOnTimeout = () => {
4265
+ if (!request) return;
4266
+ const xhr = request;
4267
+ xhr.ontimeout();
4268
+ xhr.abort();
4269
+ };
4270
+ if (deadline !== undefined) {
4271
+ const scheduleTimeout = () => {
4272
+ const remaining = deadline - now();
4273
+ if (remaining > 0) {
4274
+ // Browser timers overflow above the signed 32-bit delay limit.
4275
+ timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 0x7fffffff));
4276
+ } else {
4277
+ abortOnTimeout();
4278
+ }
4279
+ };
4280
+ scheduleTimeout();
4281
+ }
4282
+
4283
+ cookies
4284
+ .readAsync(xsrfCookieName)
4285
+ .then((value) => {
4286
+ if (!request) return;
4287
+ // Promise callbacks may run before an overdue timer after a busy task.
4288
+ if (deadline !== undefined && now() >= deadline) {
4289
+ abortOnTimeout();
4290
+ return;
4291
+ }
4292
+ if (value) {
4293
+ const headerName =
4294
+ utils$1.hasOwnProp(_config, 'xsrfHeaderName') && _config.xsrfHeaderName;
4295
+ requestHeaders.set(headerName, value);
4296
+ }
4297
+ sendRequest();
4298
+ })
4299
+ .catch((error) => {
4300
+ if (!request) return;
4301
+ reject(AxiosError.from(error, null, config, request));
4302
+ done();
4303
+ request = null;
4304
+ });
4305
+ } else {
4306
+ sendRequest();
4307
+ }
3162
4308
  });
3163
4309
  };
3164
4310
 
@@ -3194,18 +4340,32 @@ const composeSignals = (signals, timeout) => {
3194
4340
  }, timeout);
3195
4341
 
3196
4342
  const unsubscribe = () => {
3197
- if (!signals) { return; }
4343
+ if (!signals) {
4344
+ return;
4345
+ }
3198
4346
  timer && clearTimeout(timer);
3199
4347
  timer = null;
3200
4348
  signals.forEach((signal) => {
3201
- signal.unsubscribe
3202
- ? signal.unsubscribe(onabort)
4349
+ const unsubscribeSignal = utils$1.getSafeProp(signal, 'unsubscribe');
4350
+ utils$1.isFunction(unsubscribeSignal)
4351
+ ? unsubscribeSignal.call(signal, onabort)
3203
4352
  : signal.removeEventListener('abort', onabort);
3204
4353
  });
3205
4354
  signals = null;
3206
4355
  };
3207
4356
 
3208
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
4357
+ signals.forEach((signal) => {
4358
+ if (aborted) {
4359
+ return;
4360
+ }
4361
+
4362
+ if (signal.aborted) {
4363
+ onabort.call(signal);
4364
+ return;
4365
+ }
4366
+
4367
+ signal.addEventListener('abort', onabort, { once: true });
4368
+ });
3209
4369
 
3210
4370
  const { signal } = controller;
3211
4371
 
@@ -3304,89 +4464,274 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3304
4464
  );
3305
4465
  };
3306
4466
 
4467
+ const CRLF = '\r\n';
4468
+ const normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF);
4469
+ const escapeName = (value) =>
4470
+ String(value).replace(/[\r\n"]/g, (char) =>
4471
+ char === '\r' ? '%0D' : char === '\n' ? '%0A' : '%22'
4472
+ );
4473
+
4474
+ // Count UTF-8 bytes without allocating an encoded copy of a field. FormData
4475
+ // string values normalize line endings; Blob/File contents remain unchanged.
4476
+ const stringBytes = (value, normalize) => {
4477
+ let length = 0;
4478
+ for (let i = 0; i < value.length; i++) {
4479
+ const code = value.charCodeAt(i);
4480
+ if (normalize && (code === 13 || code === 10)) {
4481
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
4482
+ length += 2;
4483
+ } else if (code < 0x80) {
4484
+ length++;
4485
+ } else if (code < 0x800) {
4486
+ length += 2;
4487
+ } else if (
4488
+ code >= 0xd800 &&
4489
+ code <= 0xdbff &&
4490
+ value.charCodeAt(i + 1) >= 0xdc00 &&
4491
+ value.charCodeAt(i + 1) <= 0xdfff
4492
+ ) {
4493
+ length += 4;
4494
+ i++;
4495
+ } else {
4496
+ length += 3;
4497
+ }
4498
+ }
4499
+ return length;
4500
+ };
4501
+
4502
+ // Describe serialization failures independently of any request library.
4503
+ class FormDataError extends TypeError {
4504
+ constructor(message, reason) {
4505
+ super(message);
4506
+ this.name = 'FormDataError';
4507
+ this.reason = reason;
4508
+ }
4509
+ }
4510
+
4511
+ // The caller supplies the boundary, Blob implementation, and limit error.
4512
+ function formDataToBlob(form, Blob, limit, limitError, boundary) {
4513
+ if (!utils$1.isFunction(Blob)) {
4514
+ throw new FormDataError('Blob is not supported', 'blob');
4515
+ }
4516
+
4517
+ if (
4518
+ !utils$1.isString(boundary) ||
4519
+ !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) ||
4520
+ / $/.test(boundary)
4521
+ ) {
4522
+ throw new FormDataError('Invalid multipart boundary', 'boundary');
4523
+ }
4524
+ const footer = '--' + boundary + '--' + CRLF;
4525
+ let length = footer.length;
4526
+ const parts = [];
4527
+ const checkLength = (extra) => {
4528
+ if (length + extra > limit) throw limitError();
4529
+ };
4530
+ checkLength(0);
4531
+
4532
+ for (const [name, value] of form) {
4533
+ const isString = utils$1.isString(value);
4534
+ const valueLength = isString ? stringBytes(value, true) : value.size;
4535
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
4536
+ throw new FormDataError('Unsupported FormData part size', 'part');
4537
+ }
4538
+ // Reject large values and names before building normalized header strings.
4539
+ checkLength(
4540
+ valueLength +
4541
+ stringBytes(name, true) +
4542
+ (!isString && value.name ? stringBytes(value.name, false) : 0) +
4543
+ (!isString && value.type ? stringBytes(value.type, false) : 0)
4544
+ );
4545
+
4546
+ let header =
4547
+ '--' +
4548
+ boundary +
4549
+ CRLF +
4550
+ 'Content-Disposition: form-data; name="' +
4551
+ escapeName(normalizeLines(name)) +
4552
+ '"';
4553
+ if (!isString) {
4554
+ header +=
4555
+ '; filename="' +
4556
+ escapeName(utils$1.isString(value.name) ? value.name : 'blob') +
4557
+ '"' +
4558
+ CRLF +
4559
+ 'Content-Type: ' +
4560
+ String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
4561
+ }
4562
+ header += CRLF + CRLF;
4563
+ const partLength = stringBytes(header, false) + valueLength + CRLF.length;
4564
+ checkLength(partLength);
4565
+ length += partLength;
4566
+ parts.push({ header, value, isString });
4567
+ }
4568
+
4569
+ // Native Blob composition retains existing Blob/File data. No file is read
4570
+ // and no complete multipart ArrayBuffer is created to determine its length.
4571
+ const blobParts = [];
4572
+ for (const part of parts) {
4573
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
4574
+ }
4575
+ blobParts.push(footer);
4576
+ return new Blob(blobParts, { type: 'multipart/form-data; boundary=' + boundary });
4577
+ }
4578
+
4579
+ function createMultipartBody(form, Blob, limit, limitError, boundary) {
4580
+ // Report missing Blob support before trying to select a random source.
4581
+ if (!utils$1.isFunction(Blob)) {
4582
+ throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
4583
+ }
4584
+
4585
+ if (boundary === undefined) {
4586
+ if (utils$1.isFunction(platform.generateString)) {
4587
+ boundary = 'axios-' + platform.generateString(36, '0123456789abcdef');
4588
+ } else {
4589
+ const crypto = utils$1.global.crypto;
4590
+ if (!crypto || !utils$1.isFunction(crypto.getRandomValues)) {
4591
+ throw new AxiosError('Random byte generation is not supported', AxiosError.ERR_NOT_SUPPORT);
4592
+ }
4593
+ const random = new Uint8Array(18);
4594
+ crypto.getRandomValues(random);
4595
+ boundary =
4596
+ 'axios-' + Array.from(random, (value) => ('0' + value.toString(16)).slice(-2)).join('');
4597
+ }
4598
+ }
4599
+
4600
+ try {
4601
+ return formDataToBlob(form, Blob, limit, limitError, boundary);
4602
+ } catch (error) {
4603
+ if (error instanceof FormDataError) {
4604
+ const code =
4605
+ error.reason === 'boundary' ? AxiosError.ERR_BAD_OPTION_VALUE : AxiosError.ERR_BAD_REQUEST;
4606
+ throw new AxiosError(error.message, code);
4607
+ }
4608
+ throw error;
4609
+ }
4610
+ }
4611
+
3307
4612
  /**
3308
- * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3309
- * - For base64: compute exact decoded size using length and padding;
3310
- * handle %XX at the character-count level (no string allocation).
3311
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3312
- *
3313
- * @param {string} url
3314
- * @returns {number}
4613
+ * Estimate data: URL byte lengths *without* allocating large buffers.
4614
+ * - Fetch percent-decodes a base64 body before decoding it.
4615
+ * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
4616
+ * percent-decoded body, including ignored characters and content after padding.
4617
+ * - Non-base64 data is percent-decoded and then encoded as UTF-8.
3315
4618
  */
3316
- function estimateDataURLDecodedBytes(url) {
3317
- if (!url || typeof url !== 'string') return 0;
3318
- if (!url.startsWith('data:')) return 0;
4619
+ const isHexDigit = (charCode) =>
4620
+ (charCode >= 48 && charCode <= 57) ||
4621
+ (charCode >= 65 && charCode <= 70) ||
4622
+ (charCode >= 97 && charCode <= 102);
4623
+
4624
+ const isPercentEncodedByte = (str, i, len) =>
4625
+ i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
4626
+
4627
+ const hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);
4628
+
4629
+ const isBase64Char = (charCode) =>
4630
+ (charCode >= 65 && charCode <= 90) || // A-Z
4631
+ (charCode >= 97 && charCode <= 122) || // a-z
4632
+ (charCode >= 48 && charCode <= 57) || // 0-9
4633
+ charCode === 43 || // +
4634
+ charCode === 47 || // /
4635
+ charCode === 45 || // - (base64url)
4636
+ charCode === 95; // _ (base64url)
4637
+
4638
+ const isBase64Whitespace = (charCode) =>
4639
+ charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
4640
+
4641
+ const base64Bytes = (significant) => {
4642
+ const groups = Math.floor(significant / 4);
4643
+ const remainder = significant % 4;
4644
+ return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
4645
+ };
3319
4646
 
3320
- const comma = url.indexOf(',');
3321
- if (comma < 0) return 0;
4647
+ // Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
4648
+ // upper bound even when Buffer.from later ignores characters or stops at '='.
4649
+ const estimateBase64BufferAllocation = (body) => {
4650
+ const len = body.length;
4651
+ let padding = 0;
3322
4652
 
3323
- const meta = url.slice(5, comma);
3324
- const body = url.slice(comma + 1);
3325
- const isBase64 = /;base64/i.test(meta);
4653
+ if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
4654
+ padding++;
3326
4655
 
3327
- if (isBase64) {
3328
- let effectiveLen = body.length;
3329
- const len = body.length; // cache length
3330
-
3331
- for (let i = 0; i < len; i++) {
3332
- if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3333
- const a = body.charCodeAt(i + 1);
3334
- const b = body.charCodeAt(i + 2);
3335
- const isHex =
3336
- ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
3337
- ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
3338
-
3339
- if (isHex) {
3340
- effectiveLen -= 2;
3341
- i += 2;
3342
- }
3343
- }
4656
+ if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
4657
+ padding++;
3344
4658
  }
4659
+ }
3345
4660
 
3346
- let pad = 0;
3347
- let idx = len - 1;
4661
+ return Math.floor(((len - padding) * 3) / 4);
4662
+ };
3348
4663
 
3349
- const tailIsPct3D = (j) =>
3350
- j >= 2 &&
3351
- body.charCodeAt(j - 2) === 37 && // '%'
3352
- body.charCodeAt(j - 1) === 51 && // '3'
3353
- (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
4664
+ const estimatePercentDecodedBase64Bytes = (body) => {
4665
+ const len = body.length;
4666
+ let significant = 0;
4667
+ let padding = 0;
4668
+ let invalid = false;
3354
4669
 
3355
- if (idx >= 0) {
3356
- if (body.charCodeAt(idx) === 61 /* '=' */) {
3357
- pad++;
3358
- idx--;
3359
- } else if (tailIsPct3D(idx)) {
3360
- pad++;
3361
- idx -= 3;
3362
- }
4670
+ for (let i = 0; i < len; i++) {
4671
+ let code = body.charCodeAt(i);
4672
+
4673
+ if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
4674
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
4675
+ i += 2;
3363
4676
  }
3364
4677
 
3365
- if (pad === 1 && idx >= 0) {
3366
- if (body.charCodeAt(idx) === 61 /* '=' */) {
3367
- pad++;
3368
- } else if (tailIsPct3D(idx)) {
3369
- pad++;
3370
- }
4678
+ if (isBase64Whitespace(code)) {
4679
+ continue;
4680
+ }
4681
+
4682
+ if (code === 61 /* '=' */) {
4683
+ padding++;
4684
+ continue;
3371
4685
  }
3372
4686
 
3373
- const groups = Math.floor(effectiveLen / 4);
3374
- const bytes = groups * 3 - (pad || 0);
3375
- return bytes > 0 ? bytes : 0;
4687
+ if (!isBase64Char(code) || padding > 0) {
4688
+ invalid = true;
4689
+ continue;
4690
+ }
4691
+
4692
+ significant++;
4693
+ }
4694
+
4695
+ // Fetch rejects malformed forgiving-base64 input. Returning the raw-size
4696
+ // allocation bound keeps that invalid input from becoming a pre-check bypass.
4697
+ if (
4698
+ invalid ||
4699
+ padding > 2 ||
4700
+ (padding > 0 && (significant + padding) % 4 !== 0) ||
4701
+ significant % 4 === 1
4702
+ ) {
4703
+ return estimateBase64BufferAllocation(body);
3376
4704
  }
3377
4705
 
3378
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3379
- return Buffer.byteLength(body, 'utf8');
4706
+ return base64Bytes(significant);
4707
+ };
4708
+
4709
+ const estimateDataURLBytes = (url, estimateBase64, base64Pattern) => {
4710
+ if (!url || typeof url !== 'string') return 0;
4711
+ if (!/^data:/i.test(url)) return 0;
4712
+
4713
+ const comma = url.indexOf(',');
4714
+ if (comma < 0) return 0;
4715
+
4716
+ const meta = url.slice(5, comma);
4717
+ const body = url.slice(comma + 1);
4718
+ const isBase64 = base64Pattern.test(meta);
4719
+
4720
+ if (isBase64) {
4721
+ return estimateBase64(body);
3380
4722
  }
3381
4723
 
3382
4724
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3383
4725
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3384
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3385
- // but 3 UTF-8 bytes).
4726
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
4727
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
3386
4728
  let bytes = 0;
3387
4729
  for (let i = 0, len = body.length; i < len; i++) {
3388
4730
  const c = body.charCodeAt(i);
3389
- if (c < 0x80) {
4731
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
4732
+ bytes += 1;
4733
+ i += 2;
4734
+ } else if (c < 0x80) {
3390
4735
  bytes += 1;
3391
4736
  } else if (c < 0x800) {
3392
4737
  bytes += 2;
@@ -3403,12 +4748,41 @@ function estimateDataURLDecodedBytes(url) {
3403
4748
  }
3404
4749
  }
3405
4750
  return bytes;
4751
+ };
4752
+
4753
+ /**
4754
+ * Estimate the percent-decoded payload size used by Fetch data: URLs.
4755
+ *
4756
+ * @param {string} url
4757
+ * @returns {number}
4758
+ */
4759
+ function estimateDataURLDecodedBytes(url) {
4760
+ // Fetch removes URL fragments before processing a data: URL.
4761
+ const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
4762
+
4763
+ return estimateDataURLBytes(
4764
+ fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
4765
+ estimatePercentDecodedBase64Bytes,
4766
+ /; *base64[\t\n\f\r ]*$/i
4767
+ );
3406
4768
  }
3407
4769
 
3408
- const VERSION = "1.17.0";
4770
+ const VERSION = "1.21.1";
3409
4771
 
3410
4772
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
3411
4773
 
4774
+ const DEFAULT_REQUEST_OPTIONS = {
4775
+ cache: 'default',
4776
+ redirect: 'follow',
4777
+ referrer: 'about:client',
4778
+ referrerPolicy: '',
4779
+ mode: 'cors',
4780
+ integrity: '',
4781
+ keepalive: false,
4782
+ priority: 'auto',
4783
+ window: null,
4784
+ };
4785
+
3412
4786
  const { isFunction } = utils$1;
3413
4787
 
3414
4788
  /**
@@ -3459,9 +4833,7 @@ const maybeWithAuthCredentials = (url) => {
3459
4833
 
3460
4834
  const factory = (env) => {
3461
4835
  const globalObject =
3462
- utils$1.global !== undefined && utils$1.global !== null
3463
- ? utils$1.global
3464
- : globalThis;
4836
+ utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
3465
4837
  const { ReadableStream, TextEncoder } = globalObject;
3466
4838
 
3467
4839
  env = utils$1.merge.call(
@@ -3471,11 +4843,13 @@ const factory = (env) => {
3471
4843
  {
3472
4844
  Request: globalObject.Request,
3473
4845
  Response: globalObject.Response,
4846
+ Blob: globalObject.Blob,
3474
4847
  },
3475
4848
  env
3476
4849
  );
3477
4850
 
3478
- const { fetch: envFetch, Request, Response } = env;
4851
+ const envFetch = utils$1.hasOwnProp(env, 'fetch') ? env.fetch : undefined;
4852
+ const { Request, Response, Blob } = env;
3479
4853
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
3480
4854
  const isRequestSupported = isFunction(Request);
3481
4855
  const isResponseSupported = isFunction(Response);
@@ -3524,6 +4898,20 @@ const factory = (env) => {
3524
4898
  isReadableStreamSupported &&
3525
4899
  test(() => utils$1.isReadableStream(new Response('').body));
3526
4900
 
4901
+ // Some runtimes reject every explicit cache mode. Use own defaults for both
4902
+ // probes so unrelated polluted options cannot affect cache-mode detection.
4903
+ const requestDefaults = Object.assign(Object.create(null), DEFAULT_REQUEST_OPTIONS);
4904
+
4905
+ if (isRequestSupported && !test(() => new Request(platform.origin, requestDefaults))) {
4906
+ delete requestDefaults.cache;
4907
+
4908
+ // Only omit cache when that makes Request construction succeed. Otherwise
4909
+ // retain the explicit default that protects supporting runtimes from pollution.
4910
+ if (!test(() => new Request(platform.origin, requestDefaults))) {
4911
+ requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
4912
+ }
4913
+ }
4914
+
3527
4915
  const resolvers = {
3528
4916
  stream: supportsResponseStream && ((res) => res.body),
3529
4917
  };
@@ -3557,14 +4945,6 @@ const factory = (env) => {
3557
4945
  return body.size;
3558
4946
  }
3559
4947
 
3560
- if (utils$1.isSpecCompliantForm(body)) {
3561
- const _request = new Request(platform.origin, {
3562
- method: 'POST',
3563
- body,
3564
- });
3565
- return (await _request.arrayBuffer()).byteLength;
3566
- }
3567
-
3568
4948
  if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3569
4949
  return body.byteLength;
3570
4950
  }
@@ -3600,6 +4980,7 @@ const factory = (env) => {
3600
4980
  fetchOptions,
3601
4981
  maxContentLength,
3602
4982
  maxBodyLength,
4983
+ maxRedirects,
3603
4984
  } = resolveConfig(config);
3604
4985
 
3605
4986
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
@@ -3626,29 +5007,45 @@ const factory = (env) => {
3626
5007
 
3627
5008
  let requestContentLength;
3628
5009
 
5010
+ // AxiosErrors we raise while request or response bodies are being streamed. Captured
5011
+ // by identity so the catch block can surface it directly, regardless of
5012
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
5013
+ // as `err.cause`; some browsers drop the original error entirely).
5014
+ let pendingBodyError = null;
5015
+ let pendingResponseError = null;
5016
+
5017
+ const maxBodyLengthError = () =>
5018
+ new AxiosError(
5019
+ 'Request body larger than maxBodyLength limit',
5020
+ AxiosError.ERR_BAD_REQUEST,
5021
+ config,
5022
+ request
5023
+ );
5024
+
3629
5025
  try {
3630
5026
  // HTTP basic authentication
3631
5027
  let auth = undefined;
3632
5028
  const configAuth = own('auth');
3633
5029
 
3634
5030
  if (configAuth) {
3635
- const username = configAuth.username || '';
3636
- const password = configAuth.password || '';
5031
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
5032
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
3637
5033
  auth = {
3638
5034
  username,
3639
- password
5035
+ password,
3640
5036
  };
3641
5037
  }
3642
5038
 
5039
+ let parsedURL;
3643
5040
  if (maybeWithAuthCredentials(url)) {
3644
- const parsedURL = new URL(url, platform.origin);
5041
+ parsedURL = new URL(url, platform.origin);
3645
5042
 
3646
5043
  if (!auth && (parsedURL.username || parsedURL.password)) {
3647
5044
  const urlUsername = decodeURIComponentSafe(parsedURL.username);
3648
5045
  const urlPassword = decodeURIComponentSafe(parsedURL.password);
3649
5046
  auth = {
3650
5047
  username: urlUsername,
3651
- password: urlPassword
5048
+ password: urlPassword,
3652
5049
  };
3653
5050
  }
3654
5051
 
@@ -3670,8 +5067,8 @@ const factory = (env) => {
3670
5067
  // Enforce maxContentLength for data: URLs up-front so we never materialize
3671
5068
  // an oversized payload. The HTTP adapter applies the same check (see http.js
3672
5069
  // "if (protocol === 'data:')" branch).
3673
- if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
3674
- const estimated = estimateDataURLDecodedBytes(url);
5070
+ if (hasMaxContentLength && parsedURL && parsedURL.protocol === 'data:') {
5071
+ const estimated = estimateDataURLDecodedBytes(parsedURL.href);
3675
5072
  if (estimated > maxContentLength) {
3676
5073
  throw new AxiosError(
3677
5074
  'maxContentLength size of ' + maxContentLength + ' exceeded',
@@ -3682,53 +5079,133 @@ const factory = (env) => {
3682
5079
  }
3683
5080
  }
3684
5081
 
3685
- // Enforce maxBodyLength against the outbound request body before dispatch.
3686
- // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
3687
- // maxBodyLength limit'). Skip when the body length cannot be determined
3688
- // (e.g. a live ReadableStream supplied by the caller).
5082
+ const formContentType =
5083
+ utils$1.isSpecCompliantForm(data) && AxiosHeaders.from(own('headers')).getContentType();
5084
+ let formBoundary;
5085
+ if (
5086
+ utils$1.isString(formContentType) &&
5087
+ /^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())
5088
+ ) {
5089
+ const parameters = AxiosHeaders.parseParameters(formContentType);
5090
+ if (utils$1.hasOwnProp(parameters, 'boundary')) formBoundary = parameters.boundary;
5091
+ }
5092
+
5093
+ if (
5094
+ utils$1.isSpecCompliantForm(data) &&
5095
+ method !== 'get' &&
5096
+ method !== 'head' &&
5097
+ (hasMaxBodyLength ||
5098
+ (onUploadProgress && supportsRequestStream) ||
5099
+ formBoundary !== undefined)
5100
+ ) {
5101
+ data = createMultipartBody(
5102
+ data,
5103
+ Blob,
5104
+ hasMaxBodyLength ? maxBodyLength : Infinity,
5105
+ maxBodyLengthError,
5106
+ formBoundary
5107
+ );
5108
+ // Blob.type lowercases its value, including a case-sensitive boundary.
5109
+ // Retain the caller's header when an explicit boundary was serialized.
5110
+ headers.setContentType(formBoundary === undefined ? data.type : formContentType);
5111
+ requestContentLength = data.size;
5112
+ }
5113
+
5114
+ // Enforce maxBodyLength against known-size bodies before dispatch using
5115
+ // the body's *actual* size — never a caller-declared Content-Length,
5116
+ // which could under-report to slip an oversized body past the check.
5117
+ // Unknown-size streams return undefined here and are counted per-chunk
5118
+ // below as fetch consumes them.
3689
5119
  if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
3690
- const outboundLength = await resolveBodyLength(headers, data);
3691
- if (
3692
- typeof outboundLength === 'number' &&
3693
- isFinite(outboundLength) &&
3694
- outboundLength > maxBodyLength
3695
- ) {
3696
- throw new AxiosError(
3697
- 'Request body larger than maxBodyLength limit',
3698
- AxiosError.ERR_BAD_REQUEST,
3699
- config,
3700
- request
3701
- );
5120
+ const outboundLength = await getBodyLength(data);
5121
+ if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
5122
+ requestContentLength = outboundLength;
5123
+ if (outboundLength > maxBodyLength) {
5124
+ throw maxBodyLengthError();
5125
+ }
3702
5126
  }
3703
5127
  }
3704
5128
 
5129
+ // A streamed body under maxBodyLength must be counted as fetch consumes
5130
+ // it; its size is never trusted from a caller-declared Content-Length.
5131
+ const mustEnforceStreamBody =
5132
+ hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
5133
+
5134
+ const trackRequestStream = (stream, onProgress, flush) =>
5135
+ trackStream(
5136
+ stream,
5137
+ DEFAULT_CHUNK_SIZE,
5138
+ (loadedBytes) => {
5139
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
5140
+ throw (pendingBodyError = maxBodyLengthError());
5141
+ }
5142
+ onProgress && onProgress(loadedBytes);
5143
+ },
5144
+ flush
5145
+ );
5146
+
3705
5147
  if (
3706
- onUploadProgress &&
3707
5148
  supportsRequestStream &&
3708
5149
  method !== 'get' &&
3709
5150
  method !== 'head' &&
3710
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
5151
+ (onUploadProgress || mustEnforceStreamBody)
3711
5152
  ) {
3712
- let _request = new Request(url, {
3713
- method: 'POST',
3714
- body: data,
3715
- duplex: 'half',
3716
- });
5153
+ requestContentLength =
5154
+ requestContentLength == null
5155
+ ? await resolveBodyLength(headers, data)
5156
+ : requestContentLength;
5157
+
5158
+ // A declared length of 0 is only trusted to skip the wrap when we are
5159
+ // not enforcing a stream limit (which must not rely on that header).
5160
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
5161
+ let _request = new Request(url, {
5162
+ method: 'POST',
5163
+ body: data,
5164
+ duplex: 'half',
5165
+ });
3717
5166
 
3718
- let contentTypeHeader;
5167
+ let contentTypeHeader;
3719
5168
 
3720
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3721
- headers.setContentType(contentTypeHeader);
3722
- }
5169
+ if (
5170
+ utils$1.isFormData(data) &&
5171
+ (contentTypeHeader = _request.headers.get('content-type'))
5172
+ ) {
5173
+ headers.setContentType(contentTypeHeader);
5174
+ }
3723
5175
 
3724
- if (_request.body) {
3725
- const [onProgress, flush] = progressEventDecorator(
3726
- requestContentLength,
3727
- progressEventReducer(asyncDecorator(onUploadProgress))
3728
- );
5176
+ if (_request.body) {
5177
+ const [onProgress, flush] =
5178
+ (onUploadProgress &&
5179
+ progressEventDecorator(
5180
+ requestContentLength,
5181
+ progressEventReducer(asyncDecorator(onUploadProgress))
5182
+ )) ||
5183
+ [];
3729
5184
 
3730
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
5185
+ data = trackRequestStream(_request.body, onProgress, flush);
5186
+ }
3731
5187
  }
5188
+ } else if (
5189
+ mustEnforceStreamBody &&
5190
+ !isRequestSupported &&
5191
+ isReadableStreamSupported &&
5192
+ method !== 'get' &&
5193
+ method !== 'head'
5194
+ ) {
5195
+ data = trackRequestStream(data);
5196
+ } else if (
5197
+ mustEnforceStreamBody &&
5198
+ isRequestSupported &&
5199
+ !supportsRequestStream &&
5200
+ method !== 'get' &&
5201
+ method !== 'head'
5202
+ ) {
5203
+ throw new AxiosError(
5204
+ 'Stream request bodies are not supported by the current fetch implementation',
5205
+ AxiosError.ERR_NOT_SUPPORT,
5206
+ config,
5207
+ request
5208
+ );
3732
5209
  }
3733
5210
 
3734
5211
  if (!utils$1.isString(withCredentials)) {
@@ -3755,26 +5232,65 @@ const factory = (env) => {
3755
5232
  // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
3756
5233
  headers.set('User-Agent', 'axios/' + VERSION, false);
3757
5234
 
3758
- const resolvedOptions = {
3759
- ...fetchOptions,
5235
+ const safeFetchOptions =
5236
+ fetchOptions == null ? fetchOptions : Object.assign(Object.create(null), fetchOptions);
5237
+
5238
+ if (safeFetchOptions) {
5239
+ // These options are owned by Axios and are already reflected in the
5240
+ // resolved Request passed to fetch.
5241
+ delete safeFetchOptions.body;
5242
+ delete safeFetchOptions.headers;
5243
+ delete safeFetchOptions.method;
5244
+ delete safeFetchOptions.signal;
5245
+ delete safeFetchOptions.duplex;
5246
+ delete safeFetchOptions.credentials;
5247
+ }
5248
+
5249
+ const resolvedOptions = Object.assign(Object.create(null), safeFetchOptions, {
3760
5250
  signal: composedSignal,
3761
5251
  method: method.toUpperCase(),
3762
5252
  headers: toByteStringHeaderObject(headers.normalize()),
3763
5253
  body: data,
3764
5254
  duplex: 'half',
3765
5255
  credentials: isCredentialsSupported ? withCredentials : undefined,
3766
- };
5256
+ });
5257
+
5258
+ if (isRequestSupported) {
5259
+ utils$1.forEach(requestDefaults, (value, key) => {
5260
+ if (resolvedOptions[key] === undefined) {
5261
+ resolvedOptions[key] = value;
5262
+ }
5263
+ });
5264
+
5265
+ if (resolvedOptions.signal === undefined) {
5266
+ resolvedOptions.signal = null;
5267
+ }
5268
+
5269
+ if (resolvedOptions.body === undefined) {
5270
+ resolvedOptions.body = null;
5271
+ }
5272
+ }
5273
+
5274
+ if (maxRedirects === 0) {
5275
+ resolvedOptions.redirect = 'manual';
5276
+
5277
+ if (safeFetchOptions) {
5278
+ safeFetchOptions.redirect = 'manual';
5279
+ }
5280
+ }
3767
5281
 
3768
5282
  request = isRequestSupported && new Request(url, resolvedOptions);
3769
5283
 
3770
5284
  let response = await (isRequestSupported
3771
- ? _fetch(request, fetchOptions)
5285
+ ? _fetch(request, safeFetchOptions)
3772
5286
  : _fetch(url, resolvedOptions));
3773
5287
 
5288
+ const responseHeaders = AxiosHeaders.from(response.headers);
5289
+
3774
5290
  // Cheap pre-check: if the server honestly declares a content-length that
3775
5291
  // already exceeds the cap, reject before we start streaming.
3776
5292
  if (hasMaxContentLength) {
3777
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
5293
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3778
5294
  if (declaredLength != null && declaredLength > maxContentLength) {
3779
5295
  throw new AxiosError(
3780
5296
  'maxContentLength size of ' + maxContentLength + ' exceeded',
@@ -3799,7 +5315,7 @@ const factory = (env) => {
3799
5315
  options[prop] = response[prop];
3800
5316
  });
3801
5317
 
3802
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
5318
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3803
5319
 
3804
5320
  const [onProgress, flush] =
3805
5321
  (onDownloadProgress &&
@@ -3814,12 +5330,12 @@ const factory = (env) => {
3814
5330
  if (hasMaxContentLength) {
3815
5331
  bytesRead = loadedBytes;
3816
5332
  if (bytesRead > maxContentLength) {
3817
- throw new AxiosError(
5333
+ throw (pendingResponseError = new AxiosError(
3818
5334
  'maxContentLength size of ' + maxContentLength + ' exceeded',
3819
5335
  AxiosError.ERR_BAD_RESPONSE,
3820
5336
  config,
3821
5337
  request
3822
- );
5338
+ ));
3823
5339
  }
3824
5340
  }
3825
5341
  onProgress && onProgress(loadedBytes);
@@ -3890,23 +5406,59 @@ const factory = (env) => {
3890
5406
  const canceledError = composedSignal.reason;
3891
5407
  canceledError.config = config;
3892
5408
  request && (canceledError.request = request);
3893
- err !== canceledError && (canceledError.cause = err);
5409
+ if (err !== canceledError) {
5410
+ // Non-enumerable to match native Error `cause` semantics so loggers
5411
+ // don't recurse into circular fetch internals (see #7205).
5412
+ Object.defineProperty(canceledError, 'cause', {
5413
+ __proto__: null,
5414
+ value: err,
5415
+ writable: true,
5416
+ enumerable: false,
5417
+ configurable: true,
5418
+ });
5419
+ }
3894
5420
  throw canceledError;
3895
5421
  }
3896
5422
 
5423
+ // Surface a maxBodyLength violation we raised while the request body was
5424
+ // being streamed. Keeping the original error (rather than reading
5425
+ // `err.cause.isAxiosError`) keeps the error deterministic across runtimes
5426
+ // and avoids both prototype-pollution reads and mis-attributing a foreign
5427
+ // AxiosError that merely happened to land in `err.cause`.
5428
+ if (pendingBodyError) {
5429
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
5430
+ throw pendingBodyError;
5431
+ }
5432
+
5433
+ if (pendingResponseError) {
5434
+ throw pendingResponseError;
5435
+ }
5436
+
5437
+ // Re-throw AxiosErrors we raised synchronously (data: URL / content-length
5438
+ // pre-checks, response size enforcement) without re-wrapping them.
5439
+ if (err instanceof AxiosError) {
5440
+ request && !err.request && (err.request = request);
5441
+ throw err;
5442
+ }
5443
+
3897
5444
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3898
- throw Object.assign(
3899
- new AxiosError(
3900
- 'Network Error',
3901
- AxiosError.ERR_NETWORK,
3902
- config,
3903
- request,
3904
- err && err.response
3905
- ),
3906
- {
3907
- cause: err.cause || err,
3908
- }
5445
+ const networkError = new AxiosError(
5446
+ 'Network Error',
5447
+ AxiosError.ERR_NETWORK,
5448
+ config,
5449
+ request,
5450
+ err && err.response
3909
5451
  );
5452
+ // Non-enumerable to match native Error `cause` semantics so loggers
5453
+ // don't recurse into circular fetch internals (see #7205).
5454
+ Object.defineProperty(networkError, 'cause', {
5455
+ __proto__: null,
5456
+ value: err.cause || err,
5457
+ writable: true,
5458
+ enumerable: false,
5459
+ configurable: true,
5460
+ });
5461
+ throw networkError;
3910
5462
  }
3911
5463
 
3912
5464
  throw AxiosError.from(err, err && err.code, config, request, err && err.response);
@@ -3917,9 +5469,15 @@ const factory = (env) => {
3917
5469
  const seedCache = new Map();
3918
5470
 
3919
5471
  const getFetch = (config) => {
3920
- let env = (config && config.env) || {};
3921
- const { fetch, Request, Response } = env;
3922
- const seeds = [Request, Response, fetch];
5472
+ const env = Object.create(null);
5473
+ const configuredEnv = config && utils$1.hasOwnProp(config, 'env') && config.env;
5474
+ ['fetch', 'Request', 'Response', 'Blob'].forEach((key) => {
5475
+ if (configuredEnv && utils$1.hasOwnProp(configuredEnv, key)) {
5476
+ env[key] = configuredEnv[key];
5477
+ }
5478
+ });
5479
+ const { fetch, Request, Response, Blob } = env;
5480
+ const seeds = [Request, Response, fetch, Blob];
3923
5481
 
3924
5482
  let len = seeds.length,
3925
5483
  i = len,
@@ -4044,7 +5602,7 @@ function getAdapter(adapters, config) {
4044
5602
 
4045
5603
  throw new AxiosError(
4046
5604
  `There is no suitable adapter to dispatch the request ` + s,
4047
- 'ERR_NOT_SUPPORT'
5605
+ AxiosError.ERR_NOT_SUPPORT
4048
5606
  );
4049
5607
  }
4050
5608
 
@@ -4085,6 +5643,37 @@ function throwIfCancellationRequested(config) {
4085
5643
  }
4086
5644
  }
4087
5645
 
5646
+ /**
5647
+ * Resolve the clock used to time adapter execution.
5648
+ *
5649
+ * Prefers the monotonic `performance.now()` so wall-clock adjustments do not
5650
+ * skew the measurement, and so frameworks that forbid reading the current
5651
+ * time during prerendering (e.g. Next.js Cache Components) accept it. Falls
5652
+ * back to `Date.now()` in runtimes without the High Resolution Time API.
5653
+ *
5654
+ * @returns {() => number} Millisecond clock
5655
+ */
5656
+ function resolveClock() {
5657
+ return typeof performance !== 'undefined' && utils$1.isFunction(performance.now)
5658
+ ? () => performance.now()
5659
+ : Date.now;
5660
+ }
5661
+
5662
+ /**
5663
+ * Whole milliseconds elapsed since `start`, floored at zero.
5664
+ *
5665
+ * Rounded so the value stays an integer as with `Date.now()`. The fallback
5666
+ * wall clock can move backwards mid-request, so the result is clamped.
5667
+ *
5668
+ * @param {() => number} now Clock returned by `resolveClock()`
5669
+ * @param {number} start Timestamp read from `now`
5670
+ *
5671
+ * @returns {number} Non-negative elapsed milliseconds
5672
+ */
5673
+ function elapsedSince(now, start) {
5674
+ return Math.max(0, Math.round(now() - start));
5675
+ }
5676
+
4088
5677
  /**
4089
5678
  * Dispatch a request to the server using the configured adapter.
4090
5679
  *
@@ -4092,10 +5681,15 @@ function throwIfCancellationRequested(config) {
4092
5681
  *
4093
5682
  * @returns {Promise} The Promise to be fulfilled
4094
5683
  */
4095
- function dispatchRequest(config) {
5684
+ function dispatchRequest(_config) {
5685
+ // Interceptors may replace the merged config with an ordinary object. Flatten
5686
+ // it at the dispatch boundary so shared prototype members cannot become
5687
+ // request behavior, while preserving intentional template/class members.
5688
+ const config = utils$1.toSafeFlatObject(_config);
5689
+
4096
5690
  throwIfCancellationRequested(config);
4097
5691
 
4098
- config.headers = AxiosHeaders.from(config.headers);
5692
+ config.headers = AxiosHeaders.from(utils$1.getSafeProp(config, 'headers'));
4099
5693
 
4100
5694
  // Transform request data
4101
5695
  config.data = transformData.call(config, config.transformRequest);
@@ -4106,10 +5700,15 @@ function dispatchRequest(config) {
4106
5700
 
4107
5701
  const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
4108
5702
 
5703
+ const now = resolveClock();
5704
+ const start = now();
5705
+
4109
5706
  return adapter(config).then(
4110
5707
  function onAdapterResolution(response) {
4111
5708
  throwIfCancellationRequested(config);
4112
5709
 
5710
+ response.duration = elapsedSince(now, start);
5711
+
4113
5712
  // Expose the current response on config so that transformResponse can
4114
5713
  // attach it to any AxiosError it throws (e.g. on JSON parse failure).
4115
5714
  // We clean it up afterwards to avoid polluting the config object.
@@ -4130,6 +5729,7 @@ function dispatchRequest(config) {
4130
5729
 
4131
5730
  // Transform response data
4132
5731
  if (reason && reason.response) {
5732
+ reason.response.duration = elapsedSince(now, start);
4133
5733
  config.response = reason.response;
4134
5734
  try {
4135
5735
  reason.response.data = transformData.call(
@@ -4225,7 +5825,7 @@ validators$1.spelling = function spelling(correctSpelling) {
4225
5825
  */
4226
5826
 
4227
5827
  function assertOptions(options, schema, allowUnknown) {
4228
- if (typeof options !== 'object') {
5828
+ if (typeof options !== 'object' || options === null) {
4229
5829
  throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
4230
5830
  }
4231
5831
  const keys = Object.keys(options);
@@ -4259,6 +5859,37 @@ var validator = {
4259
5859
 
4260
5860
  const validators = validator.validators;
4261
5861
 
5862
+ // Recognize header maps without consuming objects intended as literal values.
5863
+ // AxiosHeaders from other builds share a brand and header-container interface,
5864
+ // but not constructor identity. A tag and toJSON alone can describe a literal.
5865
+ const isHeadersBucket = (value) => {
5866
+ if (value == null || utils$1.isPlainObject(value) || value instanceof AxiosHeaders) {
5867
+ return true;
5868
+ }
5869
+
5870
+ try {
5871
+ return (
5872
+ utils$1.isObject(value) &&
5873
+ utils$1.getSafeProp(value, Symbol.toStringTag) === 'AxiosHeaders' &&
5874
+ [
5875
+ 'toJSON',
5876
+ 'set',
5877
+ 'get',
5878
+ 'has',
5879
+ 'delete',
5880
+ 'clear',
5881
+ 'normalize',
5882
+ 'concat',
5883
+ 'toString',
5884
+ Symbol.iterator,
5885
+ ].every((method) => utils$1.isFunction(utils$1.getSafeProp(value, method)))
5886
+ );
5887
+ } catch (e) {
5888
+ // A failed optional brand probe must not prevent literal header serialization.
5889
+ return false;
5890
+ }
5891
+ };
5892
+
4262
5893
  /**
4263
5894
  * Create a new instance of Axios
4264
5895
  *
@@ -4288,37 +5919,47 @@ class Axios {
4288
5919
  return await this._request(configOrUrl, config);
4289
5920
  } catch (err) {
4290
5921
  if (err instanceof Error) {
4291
- let dummy = {};
5922
+ try {
5923
+ let dummy = {};
4292
5924
 
4293
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
5925
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
4294
5926
 
4295
- // slice off the Error: ... line
4296
- const stack = (() => {
4297
- if (!dummy.stack) {
4298
- return '';
4299
- }
5927
+ const dummyStack = dummy.stack;
5928
+ let stack = '';
4300
5929
 
4301
- const firstNewlineIndex = dummy.stack.indexOf('\n');
5930
+ // slice off the Error: ... line
5931
+ if (typeof dummyStack === 'string') {
5932
+ const firstNewlineIndex = dummyStack.indexOf('\n');
5933
+
5934
+ stack = firstNewlineIndex === -1 ? '' : dummyStack.slice(firstNewlineIndex + 1);
5935
+ }
4302
5936
 
4303
- return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
4304
- })();
4305
- try {
4306
5937
  if (!err.stack) {
4307
5938
  err.stack = stack;
4308
- // match without the 2 top stack lines
4309
5939
  } else if (stack) {
5940
+ // Match a common suffix after the 2 top frames when available,
5941
+ // otherwise compare the full reconstructed stack.
4310
5942
  const firstNewlineIndex = stack.indexOf('\n');
4311
5943
  const secondNewlineIndex =
4312
5944
  firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
4313
- const stackWithoutTwoTopLines =
4314
- secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
4315
-
4316
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
4317
- err.stack += '\n' + stack;
5945
+ const duplicateCheckSuffix =
5946
+ secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
5947
+
5948
+ // `AxiosError.from()` may have already inlined the wrapped error's
5949
+ // stack under a `Caused by:` marker. Keep the reconstructed caller
5950
+ // frames ahead of that marker so stack-only reporters do not read
5951
+ // them as part of the low-level cause.
5952
+ const currentStack = String(err.stack);
5953
+ const causeIndex = getCauseStackIndex(err, currentStack);
5954
+ const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
5955
+ const causeSection = causeIndex === -1 ? '' : currentStack.slice(causeIndex);
5956
+
5957
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
5958
+ err.stack = stackHead + '\n' + stack + causeSection;
4318
5959
  }
4319
5960
  }
4320
5961
  } catch (e) {
4321
- // ignore the case where "stack" is an un-writable property
5962
+ // Ignore failures from custom stack hooks or un-writable stack properties.
4322
5963
  }
4323
5964
  }
4324
5965
 
@@ -4349,6 +5990,8 @@ class Axios {
4349
5990
  clarifyTimeoutError: validators.transitional(validators.boolean),
4350
5991
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
4351
5992
  advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
5993
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
5994
+ encodeBasicAuthUsername: validators.transitional(validators.boolean),
4352
5995
  },
4353
5996
  false
4354
5997
  );
@@ -4372,7 +6015,10 @@ class Axios {
4372
6015
  }
4373
6016
 
4374
6017
  // Set config.allowAbsoluteUrls
4375
- if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
6018
+ if (config.allowAbsoluteUrls !== undefined) ; else if (
6019
+ utils$1.hasOwnProp(this.defaults, 'allowAbsoluteUrls') &&
6020
+ this.defaults.allowAbsoluteUrls !== undefined
6021
+ ) {
4376
6022
  config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
4377
6023
  } else {
4378
6024
  config.allowAbsoluteUrls = true;
@@ -4388,14 +6034,27 @@ class Axios {
4388
6034
  );
4389
6035
 
4390
6036
  // Set config.method
4391
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
4392
-
4393
- // Flatten headers
4394
- let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
6037
+ config.method = (
6038
+ utils$1.getSafeProp(config, 'method') ||
6039
+ utils$1.getSafeProp(this.defaults, 'method') ||
6040
+ 'get'
6041
+ ).toLowerCase();
6042
+
6043
+ // Flatten header defaults without consuming literal method-named headers.
6044
+ const commonHeaders = utils$1.getSafeProp(headers, 'common');
6045
+ const methodHeaders = utils$1.getSafeProp(headers, config.method);
6046
+ const contextHeaders =
6047
+ headers &&
6048
+ utils$1.merge(
6049
+ isHeadersBucket(commonHeaders) ? commonHeaders : undefined,
6050
+ isHeadersBucket(methodHeaders) ? methodHeaders : undefined
6051
+ );
4395
6052
 
4396
6053
  headers &&
4397
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
4398
- delete headers[method];
6054
+ utils$1.forEach(methodList.concat('common'), (method) => {
6055
+ if (isHeadersBucket(utils$1.getSafeProp(headers, method))) {
6056
+ delete headers[method];
6057
+ }
4399
6058
  });
4400
6059
 
4401
6060
  config.headers = AxiosHeaders.concat(contextHeaders, headers);
@@ -4453,17 +6112,35 @@ class Axios {
4453
6112
  const onFulfilled = requestInterceptorChain[i++];
4454
6113
  const onRejected = requestInterceptorChain[i++];
4455
6114
  try {
4456
- newConfig = onFulfilled(newConfig);
6115
+ newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
4457
6116
  } catch (error) {
4458
- onRejected.call(this, error);
6117
+ if (!onRejected) {
6118
+ promise = Promise.reject(error);
6119
+ break;
6120
+ }
6121
+
6122
+ try {
6123
+ const rejectedResult = onRejected.call(this, error);
6124
+
6125
+ if (utils$1.isThenable(rejectedResult)) {
6126
+ promise = Promise.resolve(rejectedResult).then(() =>
6127
+ dispatchRequest.call(this, newConfig)
6128
+ );
6129
+ }
6130
+ } catch (rejectedError) {
6131
+ promise = Promise.reject(rejectedError);
6132
+ }
6133
+
4459
6134
  break;
4460
6135
  }
4461
6136
  }
4462
6137
 
4463
- try {
4464
- promise = dispatchRequest.call(this, newConfig);
4465
- } catch (error) {
4466
- return Promise.reject(error);
6138
+ if (!promise) {
6139
+ try {
6140
+ promise = dispatchRequest.call(this, newConfig);
6141
+ } catch (error) {
6142
+ promise = Promise.reject(error);
6143
+ }
4467
6144
  }
4468
6145
 
4469
6146
  i = 0;
@@ -4478,7 +6155,7 @@ class Axios {
4478
6155
 
4479
6156
  getUri(config) {
4480
6157
  config = mergeConfig(this.defaults, config);
4481
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
6158
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
4482
6159
  return buildURL(fullPath, config.params, config.paramsSerializer);
4483
6160
  }
4484
6161
  }
@@ -4486,12 +6163,12 @@ class Axios {
4486
6163
  // Provide aliases for supported request methods
4487
6164
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
4488
6165
  /*eslint func-names:0*/
4489
- Axios.prototype[method] = function (url, config) {
6166
+ Axios.prototype[method] = async function (url, config) {
4490
6167
  return this.request(
4491
6168
  mergeConfig(config || {}, {
4492
6169
  method,
4493
6170
  url,
4494
- data: (config || {}).data,
6171
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
4495
6172
  })
4496
6173
  );
4497
6174
  };
@@ -4499,7 +6176,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
4499
6176
 
4500
6177
  utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
4501
6178
  function generateHTTPMethod(isForm) {
4502
- return function httpMethod(url, data, config) {
6179
+ return async function httpMethod(url, data, config) {
4503
6180
  return this.request(
4504
6181
  mergeConfig(config || {}, {
4505
6182
  method,
@@ -4729,14 +6406,22 @@ const HttpStatusCode = {
4729
6406
  Gone: 410,
4730
6407
  LengthRequired: 411,
4731
6408
  PreconditionFailed: 412,
6409
+ /**
6410
+ * @deprecated Use `ContentTooLarge` instead.
6411
+ */
4732
6412
  PayloadTooLarge: 413,
6413
+ ContentTooLarge: 413,
4733
6414
  UriTooLong: 414,
4734
6415
  UnsupportedMediaType: 415,
4735
6416
  RangeNotSatisfiable: 416,
4736
6417
  ExpectationFailed: 417,
4737
6418
  ImATeapot: 418,
4738
6419
  MisdirectedRequest: 421,
6420
+ /**
6421
+ * @deprecated Use `UnprocessableContent` instead.
6422
+ */
4739
6423
  UnprocessableEntity: 422,
6424
+ UnprocessableContent: 422,
4740
6425
  Locked: 423,
4741
6426
  FailedDependency: 424,
4742
6427
  TooEarly: 425,
@@ -4756,6 +6441,7 @@ const HttpStatusCode = {
4756
6441
  LoopDetected: 508,
4757
6442
  NotExtended: 510,
4758
6443
  NetworkAuthenticationRequired: 511,
6444
+ WebServerReturnsAnUnknownError: 520,
4759
6445
  WebServerIsDown: 521,
4760
6446
  ConnectionTimedOut: 522,
4761
6447
  OriginIsUnreachable: 523,
@@ -4765,7 +6451,9 @@ const HttpStatusCode = {
4765
6451
  };
4766
6452
 
4767
6453
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
4768
- HttpStatusCode[value] = key;
6454
+ if (HttpStatusCode[value] === undefined) {
6455
+ HttpStatusCode[value] = key;
6456
+ }
4769
6457
  });
4770
6458
 
4771
6459
  /**
@@ -4836,4 +6524,3 @@ axios.HttpStatusCode = HttpStatusCode;
4836
6524
  axios.default = axios;
4837
6525
 
4838
6526
  module.exports = axios;
4839
- //# sourceMappingURL=axios.cjs.map