@openclaw/slack 2026.7.2-beta.3 → 2026.7.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (627) hide show
  1. package/README.md +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{account-inspect-Bvbtu3iH.js → account-inspect-jn1xLaVi.js} +2 -2
  4. package/dist/account-reply-mode-DrUXogvO.js +14 -0
  5. package/dist/{accounts-DQEbYKh9.js → accounts-BSr252c_.js} +6 -27
  6. package/dist/{accounts.runtime-BIKmJdtJ.js → accounts.runtime-CjULMLTa.js} +1 -1
  7. package/dist/{action-runtime-DqkRwO3Z.js → action-runtime-BO3HK_50.js} +7 -7
  8. package/dist/action-runtime.runtime-DbEcqEXC.js +2 -0
  9. package/dist/{actions-CF0tUY5q.js → actions-BkOaiDSX.js} +6 -6
  10. package/dist/{actions.runtime-hCbx4RXg.js → actions.runtime-Do-iOL51.js} +1 -1
  11. package/dist/api.js +15 -15
  12. package/dist/{approval-handler.runtime-Em8I1-8-.js → approval-handler.runtime-BAnGN7w0.js} +2 -2
  13. package/dist/{channel-4-TRi1D6.js → channel-Cnrlie9S.js} +26 -36
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel-type-Cu1yjNg2.js → channel-type-CPDX8EV-.js} +4 -4
  17. package/dist/{channel.setup-CgkADtZg.js → channel.setup-DyZdLwUB.js} +6 -25
  18. package/dist/{setup-core-CeiAVwQ3.js → config-adapter-Bb8hn2tM.js} +141 -72
  19. package/dist/{config-schema-XjJGfwQC.js → config-schema-BajbuJGL.js} +229 -30
  20. package/dist/{directory-config-Bv0lcUlH.js → directory-config-CeixfVuC.js} +2 -2
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{directory-live-CzUIB7th.js → directory-live-CUwGPX2d.js} +3 -3
  23. package/dist/doctor-contract-CsGH1Dfc.js +158 -0
  24. package/dist/doctor-contract-api.js +1 -1
  25. package/dist/{group-policy-Bw-65m3V.js → group-policy-CthIXE2T.js} +48 -7
  26. package/dist/{message-tool-api-C2pcf5du.js → message-tool-api-CvKoWYYQ.js} +1 -6
  27. package/dist/message-tool-api.js +1 -1
  28. package/dist/{monitor-CNFeF30h.js → monitor-Cb5ZsOTY.js} +4 -4
  29. package/dist/{outbound-adapter-CVi2uok0.js → outbound-adapter-sGrozuRg.js} +11 -68
  30. package/dist/{pipeline.runtime-CTvokbty.js → pipeline.runtime-mFCCSllA.js} +2173 -1999
  31. package/dist/{policy-b_dOPDCq.js → policy-DVg6FyMP.js} +1 -1
  32. package/dist/{probe-Borhn9PQ.js → probe-BhQTDVBQ.js} +51 -58
  33. package/dist/{provider-B-HVL5ZE.js → provider-PSppCU_K.js} +435 -252
  34. package/dist/{relay-source-Ea_P9VcO.js → relay-source-D0mb_JBk.js} +1 -1
  35. package/dist/{replies-B4bOdrYb.js → replies-BkPPM2Ri.js} +50 -13
  36. package/dist/{resolve-channels-KTc568SU.js → resolve-channels-B3RlJKyV.js} +2 -2
  37. package/dist/{resolve-users-DeGJf1yp.js → resolve-users-DTm7PEMa.js} +2 -2
  38. package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-8H4AJuhK.js} +1 -0
  39. package/dist/{runtime-api-BFfNpzDe.js → runtime-api-jpn3vQ7e.js} +3 -2
  40. package/dist/runtime-api.js +11 -11
  41. package/dist/{scopes-lx08L56K.js → scopes-B2SqZ--4.js} +1 -1
  42. package/dist/{security-audit-CikQhBUY.js → security-audit-DR097212.js} +1 -11
  43. package/dist/security-contract-api.js +1 -1
  44. package/dist/{send-KuTDky7i.js → send-2IoDXPeB.js} +8 -22
  45. package/dist/{send.runtime-CXyxws1D.js → send.runtime-BKd_PAEw.js} +1 -1
  46. package/dist/setup-plugin-api.js +1 -1
  47. package/dist/{setup-surface-DLA0vHXp.js → setup-surface-Dyam58nO.js} +47 -39
  48. package/dist/{shared-C4yVB0Q-.js → shared-g55DV75U.js} +16 -37
  49. package/dist/{slash-dispatch.runtime-BT-mMm-f.js → slash-dispatch.runtime-BRQbvn2e.js} +10 -9
  50. package/node_modules/@slack/bolt/dist/App.d.ts +4 -19
  51. package/node_modules/@slack/bolt/dist/App.d.ts.map +1 -1
  52. package/node_modules/@slack/bolt/dist/App.js +21 -40
  53. package/node_modules/@slack/bolt/dist/App.js.map +1 -1
  54. package/node_modules/@slack/bolt/dist/context/create-respond.d.ts +3 -3
  55. package/node_modules/@slack/bolt/dist/context/create-respond.d.ts.map +1 -1
  56. package/node_modules/@slack/bolt/dist/context/create-respond.js +13 -2
  57. package/node_modules/@slack/bolt/dist/context/create-respond.js.map +1 -1
  58. package/node_modules/@slack/bolt/dist/errors.d.ts +6 -8
  59. package/node_modules/@slack/bolt/dist/errors.d.ts.map +1 -1
  60. package/node_modules/@slack/bolt/dist/errors.js +11 -11
  61. package/node_modules/@slack/bolt/dist/errors.js.map +1 -1
  62. package/node_modules/@slack/bolt/dist/helpers.d.ts.map +1 -1
  63. package/node_modules/@slack/bolt/dist/helpers.js +1 -2
  64. package/node_modules/@slack/bolt/dist/helpers.js.map +1 -1
  65. package/node_modules/@slack/bolt/dist/index.d.ts +0 -1
  66. package/node_modules/@slack/bolt/dist/index.d.ts.map +1 -1
  67. package/node_modules/@slack/bolt/dist/index.js +1 -3
  68. package/node_modules/@slack/bolt/dist/index.js.map +1 -1
  69. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.d.ts +10 -1
  70. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.d.ts.map +1 -1
  71. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.js +5 -1
  72. package/node_modules/@slack/bolt/dist/receivers/AwsLambdaReceiver.js.map +1 -1
  73. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.d.ts.map +1 -1
  74. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.js +10 -14
  75. package/node_modules/@slack/bolt/dist/receivers/HTTPModuleFunctions.js.map +1 -1
  76. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.d.ts.map +1 -1
  77. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.js +1 -1
  78. package/node_modules/@slack/bolt/dist/receivers/SocketModeFunctions.js.map +1 -1
  79. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.d.ts +3 -1
  80. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.d.ts.map +1 -1
  81. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.js +2 -1
  82. package/node_modules/@slack/bolt/dist/receivers/SocketModeReceiver.js.map +1 -1
  83. package/node_modules/@slack/bolt/dist/types/actions/index.d.ts +2 -4
  84. package/node_modules/@slack/bolt/dist/types/actions/index.d.ts.map +1 -1
  85. package/node_modules/@slack/bolt/dist/types/actions/index.js +0 -2
  86. package/node_modules/@slack/bolt/dist/types/actions/index.js.map +1 -1
  87. package/node_modules/@slack/bolt/dist/types/events/index.d.ts +2 -0
  88. package/node_modules/@slack/bolt/dist/types/events/index.d.ts.map +1 -1
  89. package/node_modules/@slack/bolt/dist/types/utilities.d.ts +2 -2
  90. package/node_modules/@slack/bolt/dist/types/utilities.d.ts.map +1 -1
  91. package/node_modules/@slack/bolt/dist/types/view/index.d.ts +1 -31
  92. package/node_modules/@slack/bolt/dist/types/view/index.d.ts.map +1 -1
  93. package/node_modules/@slack/bolt/package.json +10 -11
  94. package/node_modules/@slack/logger/README.md +1 -1
  95. package/node_modules/@slack/logger/dist/index.js +17 -13
  96. package/node_modules/@slack/logger/dist/index.js.map +1 -1
  97. package/node_modules/@slack/logger/package.json +6 -7
  98. package/node_modules/@slack/oauth/README.md +1 -1
  99. package/node_modules/@slack/oauth/dist/errors.d.ts +25 -14
  100. package/node_modules/@slack/oauth/dist/errors.d.ts.map +1 -1
  101. package/node_modules/@slack/oauth/dist/errors.js +24 -33
  102. package/node_modules/@slack/oauth/dist/errors.js.map +1 -1
  103. package/node_modules/@slack/oauth/dist/install-provider.js +58 -16
  104. package/node_modules/@slack/oauth/dist/install-provider.js.map +1 -1
  105. package/node_modules/@slack/oauth/dist/installation-stores/file-store.js +4 -2
  106. package/node_modules/@slack/oauth/dist/installation-stores/file-store.js.map +1 -1
  107. package/node_modules/@slack/oauth/dist/installation-stores/memory-store.js +3 -16
  108. package/node_modules/@slack/oauth/dist/installation-stores/memory-store.js.map +1 -1
  109. package/node_modules/@slack/oauth/dist/state-stores/clear-state-store.js +2 -0
  110. package/node_modules/@slack/oauth/dist/state-stores/clear-state-store.js.map +1 -1
  111. package/node_modules/@slack/oauth/dist/state-stores/file-state-store.js +3 -0
  112. package/node_modules/@slack/oauth/dist/state-stores/file-state-store.js.map +1 -1
  113. package/node_modules/@slack/oauth/package.json +8 -9
  114. package/node_modules/@slack/socket-mode/README.md +1 -1
  115. package/node_modules/@slack/socket-mode/dist/package.json +21 -13
  116. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts +14 -8
  117. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.d.ts.map +1 -1
  118. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +136 -48
  119. package/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js.map +1 -1
  120. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts +12 -6
  121. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.d.ts.map +1 -1
  122. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js +87 -38
  123. package/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js.map +1 -1
  124. package/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts +31 -1
  125. package/node_modules/@slack/socket-mode/dist/src/SocketModeOptions.d.ts.map +1 -1
  126. package/node_modules/@slack/socket-mode/dist/src/errors.d.ts +31 -37
  127. package/node_modules/@slack/socket-mode/dist/src/errors.d.ts.map +1 -1
  128. package/node_modules/@slack/socket-mode/dist/src/errors.js +43 -47
  129. package/node_modules/@slack/socket-mode/dist/src/errors.js.map +1 -1
  130. package/node_modules/@slack/socket-mode/dist/src/index.d.ts +2 -2
  131. package/node_modules/@slack/socket-mode/dist/src/index.d.ts.map +1 -1
  132. package/node_modules/@slack/socket-mode/dist/src/index.js +7 -1
  133. package/node_modules/@slack/socket-mode/dist/src/index.js.map +1 -1
  134. package/node_modules/@slack/socket-mode/package.json +21 -13
  135. package/node_modules/@slack/types/README.md +1 -1
  136. package/node_modules/@slack/types/dist/events/app.d.ts +28 -0
  137. package/node_modules/@slack/types/dist/events/app.d.ts.map +1 -1
  138. package/node_modules/@slack/types/dist/events/index.d.ts +2 -2
  139. package/node_modules/@slack/types/dist/events/index.d.ts.map +1 -1
  140. package/node_modules/@slack/types/dist/events/index.js.map +1 -1
  141. package/node_modules/@slack/types/dist/events/message.d.ts +2 -0
  142. package/node_modules/@slack/types/dist/events/message.d.ts.map +1 -1
  143. package/node_modules/@slack/types/package.json +3 -3
  144. package/node_modules/@slack/web-api/README.md +1 -1
  145. package/node_modules/@slack/web-api/dist/WebClient.d.ts +42 -71
  146. package/node_modules/@slack/web-api/dist/WebClient.d.ts.map +1 -1
  147. package/node_modules/@slack/web-api/dist/WebClient.js +180 -248
  148. package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
  149. package/node_modules/@slack/web-api/dist/chat-stream.js +37 -22
  150. package/node_modules/@slack/web-api/dist/chat-stream.js.map +1 -1
  151. package/node_modules/@slack/web-api/dist/errors.d.ts +32 -51
  152. package/node_modules/@slack/web-api/dist/errors.d.ts.map +1 -1
  153. package/node_modules/@slack/web-api/dist/errors.js +64 -55
  154. package/node_modules/@slack/web-api/dist/errors.js.map +1 -1
  155. package/node_modules/@slack/web-api/dist/file-upload.d.ts +0 -9
  156. package/node_modules/@slack/web-api/dist/file-upload.d.ts.map +1 -1
  157. package/node_modules/@slack/web-api/dist/file-upload.js +41 -46
  158. package/node_modules/@slack/web-api/dist/file-upload.js.map +1 -1
  159. package/node_modules/@slack/web-api/dist/index.d.ts +2 -2
  160. package/node_modules/@slack/web-api/dist/index.d.ts.map +1 -1
  161. package/node_modules/@slack/web-api/dist/index.js +8 -1
  162. package/node_modules/@slack/web-api/dist/index.js.map +1 -1
  163. package/node_modules/@slack/web-api/dist/methods.d.ts +2 -38
  164. package/node_modules/@slack/web-api/dist/methods.d.ts.map +1 -1
  165. package/node_modules/@slack/web-api/dist/methods.js +1347 -1384
  166. package/node_modules/@slack/web-api/dist/methods.js.map +1 -1
  167. package/node_modules/@slack/web-api/dist/types/request/files.d.ts +0 -1
  168. package/node_modules/@slack/web-api/dist/types/request/files.d.ts.map +1 -1
  169. package/node_modules/@slack/web-api/dist/types/request/index.d.ts +3 -3
  170. package/node_modules/@slack/web-api/dist/types/request/index.d.ts.map +1 -1
  171. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts +66 -1
  172. package/node_modules/@slack/web-api/dist/types/request/manifest.d.ts.map +1 -1
  173. package/node_modules/@slack/web-api/dist/types/request/rtm.d.ts +1 -14
  174. package/node_modules/@slack/web-api/dist/types/request/rtm.d.ts.map +1 -1
  175. package/node_modules/@slack/web-api/dist/types/request/workflows.d.ts +0 -29
  176. package/node_modules/@slack/web-api/dist/types/request/workflows.d.ts.map +1 -1
  177. package/node_modules/@slack/web-api/package.json +6 -10
  178. package/node_modules/@types/node/README.md +1 -1
  179. package/node_modules/@types/node/fs/promises.d.ts +16 -6
  180. package/node_modules/@types/node/package.json +2 -2
  181. package/node_modules/@types/retry/LICENSE +21 -21
  182. package/node_modules/@types/retry/README.md +5 -4
  183. package/node_modules/@types/retry/index.d.ts +20 -13
  184. package/node_modules/@types/retry/package.json +9 -11
  185. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  186. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  187. package/node_modules/iconv-lite/package.json +2 -2
  188. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  189. package/node_modules/path-to-regexp/Readme.md +3 -3
  190. package/node_modules/path-to-regexp/dist/index.js +135 -158
  191. package/node_modules/path-to-regexp/dist/index.js.map +1 -1
  192. package/node_modules/path-to-regexp/package.json +2 -2
  193. package/node_modules/qs/CHANGELOG.md +11 -0
  194. package/node_modules/qs/dist/qs.js +17 -17
  195. package/node_modules/qs/lib/parse.js +19 -8
  196. package/node_modules/qs/lib/utils.js +47 -8
  197. package/node_modules/qs/package.json +6 -5
  198. package/node_modules/qs/test/parse.js +230 -0
  199. package/node_modules/qs/test/utils.js +194 -0
  200. package/node_modules/typebox/build/compile/validator.d.mts +1 -4
  201. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  202. package/node_modules/typebox/build/guard/guard.mjs +5 -2
  203. package/node_modules/typebox/build/guard/string.mjs +16 -4
  204. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  205. package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
  206. package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
  207. package/node_modules/typebox/build/typebox.d.mts +1 -1
  208. package/node_modules/typebox/build/typebox.mjs +1 -1
  209. package/node_modules/typebox/package.json +1 -1
  210. package/node_modules/typebox/readme.md +29 -32
  211. package/node_modules/{es-set-tostringtag → undici}/LICENSE +1 -1
  212. package/node_modules/undici/README.md +741 -0
  213. package/node_modules/undici/docs/docs/api/Agent.md +84 -0
  214. package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
  215. package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
  216. package/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
  217. package/node_modules/undici/docs/docs/api/Client.md +288 -0
  218. package/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
  219. package/node_modules/undici/docs/docs/api/Connector.md +115 -0
  220. package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
  221. package/node_modules/undici/docs/docs/api/Cookies.md +128 -0
  222. package/node_modules/undici/docs/docs/api/Debug.md +62 -0
  223. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
  224. package/node_modules/undici/docs/docs/api/Dispatcher.md +1392 -0
  225. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
  226. package/node_modules/undici/docs/docs/api/Errors.md +49 -0
  227. package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
  228. package/node_modules/undici/docs/docs/api/Fetch.md +60 -0
  229. package/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
  230. package/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
  231. package/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
  232. package/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
  233. package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
  234. package/node_modules/undici/docs/docs/api/MockClient.md +81 -0
  235. package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
  236. package/node_modules/undici/docs/docs/api/MockPool.md +555 -0
  237. package/node_modules/undici/docs/docs/api/Pool.md +84 -0
  238. package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
  239. package/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
  240. package/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
  241. package/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
  242. package/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
  243. package/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
  244. package/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
  245. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +275 -0
  246. package/node_modules/undici/docs/docs/api/Util.md +25 -0
  247. package/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
  248. package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
  249. package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
  250. package/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
  251. package/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
  252. package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
  253. package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
  254. package/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
  255. package/node_modules/undici/index-fetch.js +65 -0
  256. package/node_modules/undici/index.d.ts +3 -0
  257. package/node_modules/undici/index.js +234 -0
  258. package/node_modules/undici/lib/api/abort-signal.js +59 -0
  259. package/node_modules/undici/lib/api/api-connect.js +110 -0
  260. package/node_modules/undici/lib/api/api-pipeline.js +252 -0
  261. package/node_modules/undici/lib/api/api-request.js +214 -0
  262. package/node_modules/undici/lib/api/api-stream.js +209 -0
  263. package/node_modules/undici/lib/api/api-upgrade.js +111 -0
  264. package/node_modules/undici/lib/api/index.js +7 -0
  265. package/node_modules/undici/lib/api/readable.js +580 -0
  266. package/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
  267. package/node_modules/undici/lib/cache/sqlite-cache-store.js +461 -0
  268. package/node_modules/undici/lib/core/connect.js +153 -0
  269. package/node_modules/undici/lib/core/constants.js +143 -0
  270. package/node_modules/undici/lib/core/diagnostics.js +227 -0
  271. package/node_modules/undici/lib/core/errors.js +477 -0
  272. package/node_modules/undici/lib/core/request.js +453 -0
  273. package/node_modules/undici/lib/core/socks5-client.js +422 -0
  274. package/node_modules/undici/lib/core/socks5-utils.js +212 -0
  275. package/node_modules/undici/lib/core/symbols.js +75 -0
  276. package/node_modules/undici/lib/core/tree.js +160 -0
  277. package/node_modules/undici/lib/core/util.js +992 -0
  278. package/node_modules/undici/lib/dispatcher/agent.js +158 -0
  279. package/node_modules/undici/lib/dispatcher/balanced-pool.js +219 -0
  280. package/node_modules/undici/lib/dispatcher/client-h1.js +1722 -0
  281. package/node_modules/undici/lib/dispatcher/client-h2.js +995 -0
  282. package/node_modules/undici/lib/dispatcher/client.js +664 -0
  283. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
  284. package/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
  285. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
  286. package/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
  287. package/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
  288. package/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
  289. package/node_modules/undici/lib/dispatcher/pool.js +118 -0
  290. package/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
  291. package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  292. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
  293. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +260 -0
  294. package/node_modules/undici/lib/encoding/index.js +33 -0
  295. package/node_modules/undici/lib/global.js +59 -0
  296. package/node_modules/undici/lib/handler/cache-handler.js +578 -0
  297. package/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
  298. package/node_modules/undici/lib/handler/decorator-handler.js +67 -0
  299. package/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
  300. package/node_modules/undici/lib/handler/redirect-handler.js +238 -0
  301. package/node_modules/undici/lib/handler/retry-handler.js +394 -0
  302. package/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
  303. package/node_modules/undici/lib/handler/wrap-handler.js +105 -0
  304. package/node_modules/undici/lib/interceptor/cache.js +495 -0
  305. package/node_modules/undici/lib/interceptor/decompress.js +259 -0
  306. package/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
  307. package/node_modules/undici/lib/interceptor/dns.js +571 -0
  308. package/node_modules/undici/lib/interceptor/dump.js +112 -0
  309. package/node_modules/undici/lib/interceptor/redirect.js +21 -0
  310. package/node_modules/undici/lib/interceptor/response-error.js +95 -0
  311. package/node_modules/undici/lib/interceptor/retry.js +19 -0
  312. package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  313. package/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
  314. package/node_modules/undici/lib/llhttp/constants.js +531 -0
  315. package/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
  316. package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
  317. package/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
  318. package/node_modules/undici/lib/llhttp/utils.js +12 -0
  319. package/node_modules/undici/lib/mock/mock-agent.js +232 -0
  320. package/node_modules/undici/lib/mock/mock-call-history.js +248 -0
  321. package/node_modules/undici/lib/mock/mock-client.js +68 -0
  322. package/node_modules/undici/lib/mock/mock-errors.js +29 -0
  323. package/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
  324. package/node_modules/undici/lib/mock/mock-pool.js +68 -0
  325. package/node_modules/undici/lib/mock/mock-symbols.js +32 -0
  326. package/node_modules/undici/lib/mock/mock-utils.js +486 -0
  327. package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  328. package/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
  329. package/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
  330. package/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
  331. package/node_modules/undici/lib/util/cache.js +414 -0
  332. package/node_modules/undici/lib/util/date.js +653 -0
  333. package/node_modules/undici/lib/util/promise.js +28 -0
  334. package/node_modules/undici/lib/util/runtime-features.js +124 -0
  335. package/node_modules/undici/lib/util/stats.js +32 -0
  336. package/node_modules/undici/lib/util/timers.js +425 -0
  337. package/node_modules/undici/lib/web/cache/cache.js +864 -0
  338. package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  339. package/node_modules/undici/lib/web/cache/util.js +45 -0
  340. package/node_modules/undici/lib/web/cookies/constants.js +12 -0
  341. package/node_modules/undici/lib/web/cookies/index.js +199 -0
  342. package/node_modules/undici/lib/web/cookies/parse.js +314 -0
  343. package/node_modules/undici/lib/web/cookies/util.js +282 -0
  344. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
  345. package/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
  346. package/node_modules/undici/lib/web/eventsource/util.js +29 -0
  347. package/node_modules/{has-tostringtag → undici/lib/web/fetch}/LICENSE +1 -1
  348. package/node_modules/undici/lib/web/fetch/body.js +509 -0
  349. package/node_modules/undici/lib/web/fetch/constants.js +131 -0
  350. package/node_modules/undici/lib/web/fetch/data-url.js +596 -0
  351. package/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
  352. package/node_modules/undici/lib/web/fetch/formdata.js +259 -0
  353. package/node_modules/undici/lib/web/fetch/global.js +40 -0
  354. package/node_modules/undici/lib/web/fetch/headers.js +719 -0
  355. package/node_modules/undici/lib/web/fetch/index.js +2413 -0
  356. package/node_modules/undici/lib/web/fetch/request.js +1115 -0
  357. package/node_modules/undici/lib/web/fetch/response.js +641 -0
  358. package/node_modules/undici/lib/web/fetch/util.js +1522 -0
  359. package/node_modules/undici/lib/web/infra/index.js +229 -0
  360. package/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
  361. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
  362. package/node_modules/undici/lib/web/webidl/index.js +1006 -0
  363. package/node_modules/undici/lib/web/websocket/connection.js +329 -0
  364. package/node_modules/undici/lib/web/websocket/constants.js +126 -0
  365. package/node_modules/undici/lib/web/websocket/events.js +331 -0
  366. package/node_modules/undici/lib/web/websocket/frame.js +133 -0
  367. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
  368. package/node_modules/undici/lib/web/websocket/receiver.js +507 -0
  369. package/node_modules/undici/lib/web/websocket/sender.js +109 -0
  370. package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
  371. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +498 -0
  372. package/node_modules/undici/lib/web/websocket/util.js +347 -0
  373. package/node_modules/undici/lib/web/websocket/websocket.js +758 -0
  374. package/node_modules/undici/package.json +152 -0
  375. package/node_modules/undici/scripts/strip-comments.js +10 -0
  376. package/node_modules/undici/types/README.md +6 -0
  377. package/node_modules/undici/types/agent.d.ts +32 -0
  378. package/node_modules/undici/types/api.d.ts +43 -0
  379. package/node_modules/undici/types/balanced-pool.d.ts +30 -0
  380. package/node_modules/undici/types/cache-interceptor.d.ts +179 -0
  381. package/node_modules/undici/types/cache.d.ts +36 -0
  382. package/node_modules/undici/types/client-stats.d.ts +15 -0
  383. package/node_modules/undici/types/client.d.ts +139 -0
  384. package/node_modules/undici/types/connector.d.ts +36 -0
  385. package/node_modules/undici/types/content-type.d.ts +21 -0
  386. package/node_modules/undici/types/cookies.d.ts +30 -0
  387. package/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
  388. package/node_modules/undici/types/dispatcher.d.ts +275 -0
  389. package/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
  390. package/node_modules/undici/types/errors.d.ts +177 -0
  391. package/node_modules/undici/types/eventsource.d.ts +66 -0
  392. package/node_modules/undici/types/fetch.d.ts +231 -0
  393. package/node_modules/undici/types/formdata.d.ts +114 -0
  394. package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
  395. package/node_modules/undici/types/global-origin.d.ts +7 -0
  396. package/node_modules/undici/types/h2c-client.d.ts +73 -0
  397. package/node_modules/undici/types/handlers.d.ts +14 -0
  398. package/node_modules/undici/types/header.d.ts +160 -0
  399. package/node_modules/undici/types/index.d.ts +91 -0
  400. package/node_modules/undici/types/interceptors.d.ts +80 -0
  401. package/node_modules/undici/types/mock-agent.d.ts +68 -0
  402. package/node_modules/undici/types/mock-call-history.d.ts +111 -0
  403. package/node_modules/undici/types/mock-client.d.ts +27 -0
  404. package/node_modules/undici/types/mock-errors.d.ts +12 -0
  405. package/node_modules/undici/types/mock-interceptor.d.ts +94 -0
  406. package/node_modules/undici/types/mock-pool.d.ts +27 -0
  407. package/node_modules/undici/types/patch.d.ts +29 -0
  408. package/node_modules/undici/types/pool-stats.d.ts +19 -0
  409. package/node_modules/undici/types/pool.d.ts +41 -0
  410. package/node_modules/undici/types/proxy-agent.d.ts +29 -0
  411. package/node_modules/undici/types/readable.d.ts +68 -0
  412. package/node_modules/undici/types/retry-agent.d.ts +8 -0
  413. package/node_modules/undici/types/retry-handler.d.ts +125 -0
  414. package/node_modules/undici/types/round-robin-pool.d.ts +41 -0
  415. package/node_modules/undici/types/snapshot-agent.d.ts +109 -0
  416. package/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
  417. package/node_modules/undici/types/util.d.ts +18 -0
  418. package/node_modules/undici/types/utility.d.ts +7 -0
  419. package/node_modules/undici/types/webidl.d.ts +347 -0
  420. package/node_modules/undici/types/websocket.d.ts +188 -0
  421. package/node_modules/ws/lib/receiver.js +15 -32
  422. package/node_modules/ws/lib/websocket-server.js +4 -4
  423. package/node_modules/ws/lib/websocket.js +4 -4
  424. package/node_modules/ws/package.json +5 -1
  425. package/openclaw.plugin.json +1064 -1243
  426. package/package.json +99 -18
  427. package/dist/action-runtime.runtime-DEWOcFM4.js +0 -2
  428. package/dist/config-api-Df9a1B8C.js +0 -3
  429. package/dist/doctor-contract-DKpe5VBr.js +0 -202
  430. package/dist/interactive-replies-Dm_t2R9S.js +0 -197
  431. package/dist/interactive-replies-api.js +0 -2
  432. package/node_modules/@slack/bolt/dist/WorkflowStep.d.ts +0 -159
  433. package/node_modules/@slack/bolt/dist/WorkflowStep.d.ts.map +0 -1
  434. package/node_modules/@slack/bolt/dist/WorkflowStep.js +0 -217
  435. package/node_modules/@slack/bolt/dist/WorkflowStep.js.map +0 -1
  436. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.d.ts +0 -49
  437. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.d.ts.map +0 -1
  438. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.js +0 -3
  439. package/node_modules/@slack/bolt/dist/types/actions/workflow-step-edit.js.map +0 -1
  440. package/node_modules/@types/ws/LICENSE +0 -21
  441. package/node_modules/@types/ws/README.md +0 -15
  442. package/node_modules/@types/ws/index.d.mts +0 -451
  443. package/node_modules/@types/ws/index.d.ts +0 -445
  444. package/node_modules/@types/ws/package.json +0 -72
  445. package/node_modules/asynckit/LICENSE +0 -21
  446. package/node_modules/asynckit/README.md +0 -233
  447. package/node_modules/asynckit/bench.js +0 -76
  448. package/node_modules/asynckit/index.js +0 -6
  449. package/node_modules/asynckit/lib/abort.js +0 -29
  450. package/node_modules/asynckit/lib/async.js +0 -34
  451. package/node_modules/asynckit/lib/defer.js +0 -26
  452. package/node_modules/asynckit/lib/iterate.js +0 -75
  453. package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  454. package/node_modules/asynckit/lib/readable_parallel.js +0 -25
  455. package/node_modules/asynckit/lib/readable_serial.js +0 -25
  456. package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  457. package/node_modules/asynckit/lib/state.js +0 -37
  458. package/node_modules/asynckit/lib/streamify.js +0 -141
  459. package/node_modules/asynckit/lib/terminator.js +0 -29
  460. package/node_modules/asynckit/package.json +0 -63
  461. package/node_modules/asynckit/parallel.js +0 -43
  462. package/node_modules/asynckit/serial.js +0 -17
  463. package/node_modules/asynckit/serialOrdered.js +0 -75
  464. package/node_modules/asynckit/stream.js +0 -21
  465. package/node_modules/axios/CHANGELOG.md +0 -1676
  466. package/node_modules/axios/LICENSE +0 -7
  467. package/node_modules/axios/MIGRATION_GUIDE.md +0 -877
  468. package/node_modules/axios/README.md +0 -2391
  469. package/node_modules/axios/dist/axios.js +0 -4864
  470. package/node_modules/axios/dist/axios.js.map +0 -1
  471. package/node_modules/axios/dist/axios.min.js +0 -5
  472. package/node_modules/axios/dist/axios.min.js.map +0 -1
  473. package/node_modules/axios/dist/browser/axios.cjs +0 -4701
  474. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  475. package/node_modules/axios/dist/esm/axios.js +0 -4722
  476. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  477. package/node_modules/axios/dist/esm/axios.min.js +0 -3
  478. package/node_modules/axios/dist/esm/axios.min.js.map +0 -1
  479. package/node_modules/axios/dist/node/axios.cjs +0 -5348
  480. package/node_modules/axios/dist/node/axios.cjs.map +0 -1
  481. package/node_modules/axios/index.d.cts +0 -715
  482. package/node_modules/axios/index.d.ts +0 -734
  483. package/node_modules/axios/index.js +0 -45
  484. package/node_modules/axios/lib/adapters/README.md +0 -36
  485. package/node_modules/axios/lib/adapters/adapters.js +0 -132
  486. package/node_modules/axios/lib/adapters/fetch.js +0 -469
  487. package/node_modules/axios/lib/adapters/http.js +0 -1202
  488. package/node_modules/axios/lib/adapters/xhr.js +0 -226
  489. package/node_modules/axios/lib/axios.js +0 -89
  490. package/node_modules/axios/lib/cancel/CancelToken.js +0 -135
  491. package/node_modules/axios/lib/cancel/CanceledError.js +0 -22
  492. package/node_modules/axios/lib/cancel/isCancel.js +0 -5
  493. package/node_modules/axios/lib/core/Axios.js +0 -281
  494. package/node_modules/axios/lib/core/AxiosError.js +0 -176
  495. package/node_modules/axios/lib/core/AxiosHeaders.js +0 -380
  496. package/node_modules/axios/lib/core/InterceptorManager.js +0 -72
  497. package/node_modules/axios/lib/core/README.md +0 -8
  498. package/node_modules/axios/lib/core/buildFullPath.js +0 -22
  499. package/node_modules/axios/lib/core/dispatchRequest.js +0 -89
  500. package/node_modules/axios/lib/core/mergeConfig.js +0 -124
  501. package/node_modules/axios/lib/core/settle.js +0 -27
  502. package/node_modules/axios/lib/core/transformData.js +0 -28
  503. package/node_modules/axios/lib/defaults/index.js +0 -177
  504. package/node_modules/axios/lib/defaults/transitional.js +0 -8
  505. package/node_modules/axios/lib/env/README.md +0 -3
  506. package/node_modules/axios/lib/env/classes/FormData.js +0 -2
  507. package/node_modules/axios/lib/env/data.js +0 -1
  508. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -156
  509. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -61
  510. package/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
  511. package/node_modules/axios/lib/helpers/README.md +0 -7
  512. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -29
  513. package/node_modules/axios/lib/helpers/bind.js +0 -14
  514. package/node_modules/axios/lib/helpers/buildURL.js +0 -66
  515. package/node_modules/axios/lib/helpers/callbackify.js +0 -18
  516. package/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  517. package/node_modules/axios/lib/helpers/composeSignals.js +0 -56
  518. package/node_modules/axios/lib/helpers/cookies.js +0 -60
  519. package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -31
  520. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +0 -100
  521. package/node_modules/axios/lib/helpers/formDataToJSON.js +0 -97
  522. package/node_modules/axios/lib/helpers/formDataToStream.js +0 -119
  523. package/node_modules/axios/lib/helpers/fromDataURI.js +0 -53
  524. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -19
  525. package/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  526. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  527. package/node_modules/axios/lib/helpers/null.js +0 -2
  528. package/node_modules/axios/lib/helpers/parseHeaders.js +0 -69
  529. package/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  530. package/node_modules/axios/lib/helpers/progressEventReducer.js +0 -51
  531. package/node_modules/axios/lib/helpers/readBlob.js +0 -15
  532. package/node_modules/axios/lib/helpers/resolveConfig.js +0 -106
  533. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +0 -178
  534. package/node_modules/axios/lib/helpers/speedometer.js +0 -55
  535. package/node_modules/axios/lib/helpers/spread.js +0 -28
  536. package/node_modules/axios/lib/helpers/throttle.js +0 -44
  537. package/node_modules/axios/lib/helpers/toFormData.js +0 -249
  538. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  539. package/node_modules/axios/lib/helpers/trackStream.js +0 -89
  540. package/node_modules/axios/lib/helpers/validator.js +0 -112
  541. package/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  542. package/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  543. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
  544. package/node_modules/axios/lib/platform/browser/index.js +0 -13
  545. package/node_modules/axios/lib/platform/common/utils.js +0 -52
  546. package/node_modules/axios/lib/platform/index.js +0 -7
  547. package/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
  548. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
  549. package/node_modules/axios/lib/platform/node/index.js +0 -37
  550. package/node_modules/axios/lib/utils.js +0 -931
  551. package/node_modules/axios/package.json +0 -183
  552. package/node_modules/combined-stream/License +0 -19
  553. package/node_modules/combined-stream/Readme.md +0 -138
  554. package/node_modules/combined-stream/lib/combined_stream.js +0 -208
  555. package/node_modules/combined-stream/package.json +0 -25
  556. package/node_modules/delayed-stream/.npmignore +0 -1
  557. package/node_modules/delayed-stream/License +0 -19
  558. package/node_modules/delayed-stream/Makefile +0 -7
  559. package/node_modules/delayed-stream/Readme.md +0 -141
  560. package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  561. package/node_modules/delayed-stream/package.json +0 -27
  562. package/node_modules/es-set-tostringtag/.eslintrc +0 -13
  563. package/node_modules/es-set-tostringtag/.nycrc +0 -9
  564. package/node_modules/es-set-tostringtag/CHANGELOG.md +0 -67
  565. package/node_modules/es-set-tostringtag/README.md +0 -53
  566. package/node_modules/es-set-tostringtag/index.d.ts +0 -10
  567. package/node_modules/es-set-tostringtag/index.js +0 -35
  568. package/node_modules/es-set-tostringtag/package.json +0 -78
  569. package/node_modules/es-set-tostringtag/test/index.js +0 -85
  570. package/node_modules/es-set-tostringtag/tsconfig.json +0 -9
  571. package/node_modules/follow-redirects/LICENSE +0 -18
  572. package/node_modules/follow-redirects/README.md +0 -157
  573. package/node_modules/follow-redirects/debug.js +0 -15
  574. package/node_modules/follow-redirects/http.js +0 -1
  575. package/node_modules/follow-redirects/https.js +0 -1
  576. package/node_modules/follow-redirects/index.js +0 -709
  577. package/node_modules/follow-redirects/package.json +0 -58
  578. package/node_modules/form-data/CHANGELOG.md +0 -669
  579. package/node_modules/form-data/License +0 -19
  580. package/node_modules/form-data/README.md +0 -350
  581. package/node_modules/form-data/index.d.ts +0 -51
  582. package/node_modules/form-data/lib/browser.js +0 -4
  583. package/node_modules/form-data/lib/form_data.js +0 -514
  584. package/node_modules/form-data/lib/populate.js +0 -10
  585. package/node_modules/form-data/node_modules/mime-db/HISTORY.md +0 -507
  586. package/node_modules/form-data/node_modules/mime-db/LICENSE +0 -23
  587. package/node_modules/form-data/node_modules/mime-db/README.md +0 -100
  588. package/node_modules/form-data/node_modules/mime-db/db.json +0 -8519
  589. package/node_modules/form-data/node_modules/mime-db/index.js +0 -12
  590. package/node_modules/form-data/node_modules/mime-db/package.json +0 -60
  591. package/node_modules/form-data/node_modules/mime-types/HISTORY.md +0 -397
  592. package/node_modules/form-data/node_modules/mime-types/LICENSE +0 -23
  593. package/node_modules/form-data/node_modules/mime-types/README.md +0 -113
  594. package/node_modules/form-data/node_modules/mime-types/index.js +0 -188
  595. package/node_modules/form-data/node_modules/mime-types/package.json +0 -44
  596. package/node_modules/form-data/package.json +0 -83
  597. package/node_modules/has-tostringtag/.eslintrc +0 -5
  598. package/node_modules/has-tostringtag/.github/FUNDING.yml +0 -12
  599. package/node_modules/has-tostringtag/.nycrc +0 -13
  600. package/node_modules/has-tostringtag/CHANGELOG.md +0 -42
  601. package/node_modules/has-tostringtag/README.md +0 -46
  602. package/node_modules/has-tostringtag/index.d.ts +0 -3
  603. package/node_modules/has-tostringtag/index.js +0 -8
  604. package/node_modules/has-tostringtag/package.json +0 -108
  605. package/node_modules/has-tostringtag/shams.d.ts +0 -3
  606. package/node_modules/has-tostringtag/shams.js +0 -8
  607. package/node_modules/has-tostringtag/test/index.js +0 -21
  608. package/node_modules/has-tostringtag/test/shams/core-js.js +0 -31
  609. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +0 -30
  610. package/node_modules/has-tostringtag/test/tests.js +0 -15
  611. package/node_modules/has-tostringtag/tsconfig.json +0 -49
  612. package/node_modules/is-electron/LICENSE +0 -21
  613. package/node_modules/is-electron/README.md +0 -25
  614. package/node_modules/is-electron/index.d.ts +0 -2
  615. package/node_modules/is-electron/index.js +0 -21
  616. package/node_modules/is-electron/package.json +0 -34
  617. package/node_modules/is-stream/index.d.ts +0 -79
  618. package/node_modules/is-stream/index.js +0 -28
  619. package/node_modules/is-stream/license +0 -9
  620. package/node_modules/is-stream/package.json +0 -42
  621. package/node_modules/is-stream/readme.md +0 -60
  622. package/node_modules/proxy-from-env/LICENSE +0 -20
  623. package/node_modules/proxy-from-env/README.md +0 -163
  624. package/node_modules/proxy-from-env/index.cjs +0 -105
  625. package/node_modules/proxy-from-env/index.js +0 -103
  626. package/node_modules/proxy-from-env/package.json +0 -43
  627. package/npm-shrinkwrap.json +0 -1440
@@ -1,4701 +0,0 @@
1
- /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
- 'use strict';
3
-
4
- /**
5
- * Create a bound version of a function with a specified `this` context
6
- *
7
- * @param {Function} fn - The function to bind
8
- * @param {*} thisArg - The value to be passed as the `this` parameter
9
- * @returns {Function} A new function that will call the original function with the specified `this` context
10
- */
11
- function bind(fn, thisArg) {
12
- return function wrap() {
13
- return fn.apply(thisArg, arguments);
14
- };
15
- }
16
-
17
- // utils is a library of generic helper functions non-specific to axios
18
-
19
- const { toString } = Object.prototype;
20
- const { getPrototypeOf } = Object;
21
- const { iterator, toStringTag } = Symbol;
22
-
23
- const kindOf = ((cache) => (thing) => {
24
- const str = toString.call(thing);
25
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
26
- })(Object.create(null));
27
-
28
- const kindOfTest = (type) => {
29
- type = type.toLowerCase();
30
- return (thing) => kindOf(thing) === type;
31
- };
32
-
33
- const typeOfTest = (type) => (thing) => typeof thing === type;
34
-
35
- /**
36
- * Determine if a value is a non-null object
37
- *
38
- * @param {Object} val The value to test
39
- *
40
- * @returns {boolean} True if value is an Array, otherwise false
41
- */
42
- const { isArray } = Array;
43
-
44
- /**
45
- * Determine if a value is undefined
46
- *
47
- * @param {*} val The value to test
48
- *
49
- * @returns {boolean} True if the value is undefined, otherwise false
50
- */
51
- const isUndefined = typeOfTest('undefined');
52
-
53
- /**
54
- * Determine if a value is a Buffer
55
- *
56
- * @param {*} val The value to test
57
- *
58
- * @returns {boolean} True if value is a Buffer, otherwise false
59
- */
60
- function isBuffer(val) {
61
- return (
62
- val !== null &&
63
- !isUndefined(val) &&
64
- val.constructor !== null &&
65
- !isUndefined(val.constructor) &&
66
- isFunction$1(val.constructor.isBuffer) &&
67
- val.constructor.isBuffer(val)
68
- );
69
- }
70
-
71
- /**
72
- * Determine if a value is an ArrayBuffer
73
- *
74
- * @param {*} val The value to test
75
- *
76
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
77
- */
78
- const isArrayBuffer = kindOfTest('ArrayBuffer');
79
-
80
- /**
81
- * Determine if a value is a view on an ArrayBuffer
82
- *
83
- * @param {*} val The value to test
84
- *
85
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
86
- */
87
- function isArrayBufferView(val) {
88
- let result;
89
- if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
90
- result = ArrayBuffer.isView(val);
91
- } else {
92
- result = val && val.buffer && isArrayBuffer(val.buffer);
93
- }
94
- return result;
95
- }
96
-
97
- /**
98
- * Determine if a value is a String
99
- *
100
- * @param {*} val The value to test
101
- *
102
- * @returns {boolean} True if value is a String, otherwise false
103
- */
104
- const isString = typeOfTest('string');
105
-
106
- /**
107
- * Determine if a value is a Function
108
- *
109
- * @param {*} val The value to test
110
- * @returns {boolean} True if value is a Function, otherwise false
111
- */
112
- const isFunction$1 = typeOfTest('function');
113
-
114
- /**
115
- * Determine if a value is a Number
116
- *
117
- * @param {*} val The value to test
118
- *
119
- * @returns {boolean} True if value is a Number, otherwise false
120
- */
121
- const isNumber = typeOfTest('number');
122
-
123
- /**
124
- * Determine if a value is an Object
125
- *
126
- * @param {*} thing The value to test
127
- *
128
- * @returns {boolean} True if value is an Object, otherwise false
129
- */
130
- const isObject = (thing) => thing !== null && typeof thing === 'object';
131
-
132
- /**
133
- * Determine if a value is a Boolean
134
- *
135
- * @param {*} thing The value to test
136
- * @returns {boolean} True if value is a Boolean, otherwise false
137
- */
138
- const isBoolean = (thing) => thing === true || thing === false;
139
-
140
- /**
141
- * Determine if a value is a plain Object
142
- *
143
- * @param {*} val The value to test
144
- *
145
- * @returns {boolean} True if value is a plain Object, otherwise false
146
- */
147
- const isPlainObject = (val) => {
148
- if (kindOf(val) !== 'object') {
149
- return false;
150
- }
151
-
152
- const prototype = getPrototypeOf(val);
153
- return (
154
- (prototype === null ||
155
- prototype === Object.prototype ||
156
- Object.getPrototypeOf(prototype) === null) &&
157
- !(toStringTag in val) &&
158
- !(iterator in val)
159
- );
160
- };
161
-
162
- /**
163
- * Determine if a value is an empty object (safely handles Buffers)
164
- *
165
- * @param {*} val The value to test
166
- *
167
- * @returns {boolean} True if value is an empty object, otherwise false
168
- */
169
- const isEmptyObject = (val) => {
170
- // Early return for non-objects or Buffers to prevent RangeError
171
- if (!isObject(val) || isBuffer(val)) {
172
- return false;
173
- }
174
-
175
- try {
176
- return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
177
- } catch (e) {
178
- // Fallback for any other objects that might cause RangeError with Object.keys()
179
- return false;
180
- }
181
- };
182
-
183
- /**
184
- * Determine if a value is a Date
185
- *
186
- * @param {*} val The value to test
187
- *
188
- * @returns {boolean} True if value is a Date, otherwise false
189
- */
190
- const isDate = kindOfTest('Date');
191
-
192
- /**
193
- * Determine if a value is a File
194
- *
195
- * @param {*} val The value to test
196
- *
197
- * @returns {boolean} True if value is a File, otherwise false
198
- */
199
- const isFile = kindOfTest('File');
200
-
201
- /**
202
- * Determine if a value is a React Native Blob
203
- * React Native "blob": an object with a `uri` attribute. Optionally, it can
204
- * also have a `name` and `type` attribute to specify filename and content type
205
- *
206
- * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
207
- *
208
- * @param {*} value The value to test
209
- *
210
- * @returns {boolean} True if value is a React Native Blob, otherwise false
211
- */
212
- const isReactNativeBlob = (value) => {
213
- return !!(value && typeof value.uri !== 'undefined');
214
- };
215
-
216
- /**
217
- * Determine if environment is React Native
218
- * ReactNative `FormData` has a non-standard `getParts()` method
219
- *
220
- * @param {*} formData The formData to test
221
- *
222
- * @returns {boolean} True if environment is React Native, otherwise false
223
- */
224
- const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
225
-
226
- /**
227
- * Determine if a value is a Blob
228
- *
229
- * @param {*} val The value to test
230
- *
231
- * @returns {boolean} True if value is a Blob, otherwise false
232
- */
233
- const isBlob = kindOfTest('Blob');
234
-
235
- /**
236
- * Determine if a value is a FileList
237
- *
238
- * @param {*} val The value to test
239
- *
240
- * @returns {boolean} True if value is a FileList, otherwise false
241
- */
242
- const isFileList = kindOfTest('FileList');
243
-
244
- /**
245
- * Determine if a value is a Stream
246
- *
247
- * @param {*} val The value to test
248
- *
249
- * @returns {boolean} True if value is a Stream, otherwise false
250
- */
251
- const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
252
-
253
- /**
254
- * Determine if a value is a FormData
255
- *
256
- * @param {*} thing The value to test
257
- *
258
- * @returns {boolean} True if value is an FormData, otherwise false
259
- */
260
- function getGlobal() {
261
- if (typeof globalThis !== 'undefined') return globalThis;
262
- if (typeof self !== 'undefined') return self;
263
- if (typeof window !== 'undefined') return window;
264
- if (typeof global !== 'undefined') return global;
265
- return {};
266
- }
267
-
268
- const G = getGlobal();
269
- const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
270
-
271
- const isFormData = (thing) => {
272
- if (!thing) return false;
273
- if (FormDataCtor && thing instanceof FormDataCtor) return true;
274
- // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
275
- const proto = getPrototypeOf(thing);
276
- if (!proto || proto === Object.prototype) return false;
277
- if (!isFunction$1(thing.append)) return false;
278
- const kind = kindOf(thing);
279
- return (
280
- kind === 'formdata' ||
281
- // detect form-data instance
282
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
283
- );
284
- };
285
-
286
- /**
287
- * Determine if a value is a URLSearchParams object
288
- *
289
- * @param {*} val The value to test
290
- *
291
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
292
- */
293
- const isURLSearchParams = kindOfTest('URLSearchParams');
294
-
295
- const [isReadableStream, isRequest, isResponse, isHeaders] = [
296
- 'ReadableStream',
297
- 'Request',
298
- 'Response',
299
- 'Headers',
300
- ].map(kindOfTest);
301
-
302
- /**
303
- * Trim excess whitespace off the beginning and end of a string
304
- *
305
- * @param {String} str The String to trim
306
- *
307
- * @returns {String} The String freed of excess whitespace
308
- */
309
- const trim = (str) => {
310
- return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
311
- };
312
- /**
313
- * Iterate over an Array or an Object invoking a function for each item.
314
- *
315
- * If `obj` is an Array callback will be called passing
316
- * the value, index, and complete array for each item.
317
- *
318
- * If 'obj' is an Object callback will be called passing
319
- * the value, key, and complete object for each property.
320
- *
321
- * @param {Object|Array<unknown>} obj The object to iterate
322
- * @param {Function} fn The callback to invoke for each item
323
- *
324
- * @param {Object} [options]
325
- * @param {Boolean} [options.allOwnKeys = false]
326
- * @returns {any}
327
- */
328
- function forEach(obj, fn, { allOwnKeys = false } = {}) {
329
- // Don't bother if no value provided
330
- if (obj === null || typeof obj === 'undefined') {
331
- return;
332
- }
333
-
334
- let i;
335
- let l;
336
-
337
- // Force an array if not already something iterable
338
- if (typeof obj !== 'object') {
339
- /*eslint no-param-reassign:0*/
340
- obj = [obj];
341
- }
342
-
343
- if (isArray(obj)) {
344
- // Iterate over array values
345
- for (i = 0, l = obj.length; i < l; i++) {
346
- fn.call(null, obj[i], i, obj);
347
- }
348
- } else {
349
- // Buffer check
350
- if (isBuffer(obj)) {
351
- return;
352
- }
353
-
354
- // Iterate over object keys
355
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
356
- const len = keys.length;
357
- let key;
358
-
359
- for (i = 0; i < len; i++) {
360
- key = keys[i];
361
- fn.call(null, obj[key], key, obj);
362
- }
363
- }
364
- }
365
-
366
- /**
367
- * Finds a key in an object, case-insensitive, returning the actual key name.
368
- * Returns null if the object is a Buffer or if no match is found.
369
- *
370
- * @param {Object} obj - The object to search.
371
- * @param {string} key - The key to find (case-insensitive).
372
- * @returns {?string} The actual key name if found, otherwise null.
373
- */
374
- function findKey(obj, key) {
375
- if (isBuffer(obj)) {
376
- return null;
377
- }
378
-
379
- key = key.toLowerCase();
380
- const keys = Object.keys(obj);
381
- let i = keys.length;
382
- let _key;
383
- while (i-- > 0) {
384
- _key = keys[i];
385
- if (key === _key.toLowerCase()) {
386
- return _key;
387
- }
388
- }
389
- return null;
390
- }
391
-
392
- const _global = (() => {
393
- /*eslint no-undef:0*/
394
- if (typeof globalThis !== 'undefined') return globalThis;
395
- return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
396
- })();
397
-
398
- const isContextDefined = (context) => !isUndefined(context) && context !== _global;
399
-
400
- /**
401
- * Accepts varargs expecting each argument to be an object, then
402
- * immutably merges the properties of each object and returns result.
403
- *
404
- * When multiple objects contain the same key the later object in
405
- * the arguments list will take precedence.
406
- *
407
- * Example:
408
- *
409
- * ```js
410
- * const result = merge({foo: 123}, {foo: 456});
411
- * console.log(result.foo); // outputs 456
412
- * ```
413
- *
414
- * @param {Object} obj1 Object to merge
415
- *
416
- * @returns {Object} Result of all merge properties
417
- */
418
- function merge(...objs) {
419
- const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
420
- const result = {};
421
- const assignValue = (val, key) => {
422
- // Skip dangerous property names to prevent prototype pollution
423
- if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
424
- return;
425
- }
426
-
427
- const targetKey = (caseless && findKey(result, key)) || key;
428
- // Read via own-prop only — a bare `result[targetKey]` walks the prototype
429
- // chain, so a polluted Object.prototype value could surface here and get
430
- // copied into the merged result.
431
- const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
432
- if (isPlainObject(existing) && isPlainObject(val)) {
433
- result[targetKey] = merge(existing, val);
434
- } else if (isPlainObject(val)) {
435
- result[targetKey] = merge({}, val);
436
- } else if (isArray(val)) {
437
- result[targetKey] = val.slice();
438
- } else if (!skipUndefined || !isUndefined(val)) {
439
- result[targetKey] = val;
440
- }
441
- };
442
-
443
- for (let i = 0, l = objs.length; i < l; i++) {
444
- objs[i] && forEach(objs[i], assignValue);
445
- }
446
- return result;
447
- }
448
-
449
- /**
450
- * Extends object a by mutably adding to it the properties of object b.
451
- *
452
- * @param {Object} a The object to be extended
453
- * @param {Object} b The object to copy properties from
454
- * @param {Object} thisArg The object to bind function to
455
- *
456
- * @param {Object} [options]
457
- * @param {Boolean} [options.allOwnKeys]
458
- * @returns {Object} The resulting value of object a
459
- */
460
- const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
461
- forEach(
462
- b,
463
- (val, key) => {
464
- if (thisArg && isFunction$1(val)) {
465
- Object.defineProperty(a, key, {
466
- // Null-proto descriptor so a polluted Object.prototype.get cannot
467
- // hijack defineProperty's accessor-vs-data resolution.
468
- __proto__: null,
469
- value: bind(val, thisArg),
470
- writable: true,
471
- enumerable: true,
472
- configurable: true,
473
- });
474
- } else {
475
- Object.defineProperty(a, key, {
476
- __proto__: null,
477
- value: val,
478
- writable: true,
479
- enumerable: true,
480
- configurable: true,
481
- });
482
- }
483
- },
484
- { allOwnKeys }
485
- );
486
- return a;
487
- };
488
-
489
- /**
490
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
491
- *
492
- * @param {string} content with BOM
493
- *
494
- * @returns {string} content value without BOM
495
- */
496
- const stripBOM = (content) => {
497
- if (content.charCodeAt(0) === 0xfeff) {
498
- content = content.slice(1);
499
- }
500
- return content;
501
- };
502
-
503
- /**
504
- * Inherit the prototype methods from one constructor into another
505
- * @param {function} constructor
506
- * @param {function} superConstructor
507
- * @param {object} [props]
508
- * @param {object} [descriptors]
509
- *
510
- * @returns {void}
511
- */
512
- const inherits = (constructor, superConstructor, props, descriptors) => {
513
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
514
- Object.defineProperty(constructor.prototype, 'constructor', {
515
- __proto__: null,
516
- value: constructor,
517
- writable: true,
518
- enumerable: false,
519
- configurable: true,
520
- });
521
- Object.defineProperty(constructor, 'super', {
522
- __proto__: null,
523
- value: superConstructor.prototype,
524
- });
525
- props && Object.assign(constructor.prototype, props);
526
- };
527
-
528
- /**
529
- * Resolve object with deep prototype chain to a flat object
530
- * @param {Object} sourceObj source object
531
- * @param {Object} [destObj]
532
- * @param {Function|Boolean} [filter]
533
- * @param {Function} [propFilter]
534
- *
535
- * @returns {Object}
536
- */
537
- const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
538
- let props;
539
- let i;
540
- let prop;
541
- const merged = {};
542
-
543
- destObj = destObj || {};
544
- // eslint-disable-next-line no-eq-null,eqeqeq
545
- if (sourceObj == null) return destObj;
546
-
547
- do {
548
- props = Object.getOwnPropertyNames(sourceObj);
549
- i = props.length;
550
- while (i-- > 0) {
551
- prop = props[i];
552
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
553
- destObj[prop] = sourceObj[prop];
554
- merged[prop] = true;
555
- }
556
- }
557
- sourceObj = filter !== false && getPrototypeOf(sourceObj);
558
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
559
-
560
- return destObj;
561
- };
562
-
563
- /**
564
- * Determines whether a string ends with the characters of a specified string
565
- *
566
- * @param {String} str
567
- * @param {String} searchString
568
- * @param {Number} [position= 0]
569
- *
570
- * @returns {boolean}
571
- */
572
- const endsWith = (str, searchString, position) => {
573
- str = String(str);
574
- if (position === undefined || position > str.length) {
575
- position = str.length;
576
- }
577
- position -= searchString.length;
578
- const lastIndex = str.indexOf(searchString, position);
579
- return lastIndex !== -1 && lastIndex === position;
580
- };
581
-
582
- /**
583
- * Returns new array from array like object or null if failed
584
- *
585
- * @param {*} [thing]
586
- *
587
- * @returns {?Array}
588
- */
589
- const toArray = (thing) => {
590
- if (!thing) return null;
591
- if (isArray(thing)) return thing;
592
- let i = thing.length;
593
- if (!isNumber(i)) return null;
594
- const arr = new Array(i);
595
- while (i-- > 0) {
596
- arr[i] = thing[i];
597
- }
598
- return arr;
599
- };
600
-
601
- /**
602
- * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
603
- * thing passed in is an instance of Uint8Array
604
- *
605
- * @param {TypedArray}
606
- *
607
- * @returns {Array}
608
- */
609
- // eslint-disable-next-line func-names
610
- const isTypedArray = ((TypedArray) => {
611
- // eslint-disable-next-line func-names
612
- return (thing) => {
613
- return TypedArray && thing instanceof TypedArray;
614
- };
615
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
616
-
617
- /**
618
- * For each entry in the object, call the function with the key and value.
619
- *
620
- * @param {Object<any, any>} obj - The object to iterate over.
621
- * @param {Function} fn - The function to call for each entry.
622
- *
623
- * @returns {void}
624
- */
625
- const forEachEntry = (obj, fn) => {
626
- const generator = obj && obj[iterator];
627
-
628
- const _iterator = generator.call(obj);
629
-
630
- let result;
631
-
632
- while ((result = _iterator.next()) && !result.done) {
633
- const pair = result.value;
634
- fn.call(obj, pair[0], pair[1]);
635
- }
636
- };
637
-
638
- /**
639
- * It takes a regular expression and a string, and returns an array of all the matches
640
- *
641
- * @param {string} regExp - The regular expression to match against.
642
- * @param {string} str - The string to search.
643
- *
644
- * @returns {Array<boolean>}
645
- */
646
- const matchAll = (regExp, str) => {
647
- let matches;
648
- const arr = [];
649
-
650
- while ((matches = regExp.exec(str)) !== null) {
651
- arr.push(matches);
652
- }
653
-
654
- return arr;
655
- };
656
-
657
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
658
- const isHTMLForm = kindOfTest('HTMLFormElement');
659
-
660
- const toCamelCase = (str) => {
661
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
662
- return p1.toUpperCase() + p2;
663
- });
664
- };
665
-
666
- /* Creating a function that will check if an object has a property. */
667
- const hasOwnProperty = (
668
- ({ hasOwnProperty }) =>
669
- (obj, prop) =>
670
- hasOwnProperty.call(obj, prop)
671
- )(Object.prototype);
672
-
673
- /**
674
- * Determine if a value is a RegExp object
675
- *
676
- * @param {*} val The value to test
677
- *
678
- * @returns {boolean} True if value is a RegExp object, otherwise false
679
- */
680
- const isRegExp = kindOfTest('RegExp');
681
-
682
- const reduceDescriptors = (obj, reducer) => {
683
- const descriptors = Object.getOwnPropertyDescriptors(obj);
684
- const reducedDescriptors = {};
685
-
686
- forEach(descriptors, (descriptor, name) => {
687
- let ret;
688
- if ((ret = reducer(descriptor, name, obj)) !== false) {
689
- reducedDescriptors[name] = ret || descriptor;
690
- }
691
- });
692
-
693
- Object.defineProperties(obj, reducedDescriptors);
694
- };
695
-
696
- /**
697
- * Makes all methods read-only
698
- * @param {Object} obj
699
- */
700
-
701
- const freezeMethods = (obj) => {
702
- reduceDescriptors(obj, (descriptor, name) => {
703
- // skip restricted props in strict mode
704
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
705
- return false;
706
- }
707
-
708
- const value = obj[name];
709
-
710
- if (!isFunction$1(value)) return;
711
-
712
- descriptor.enumerable = false;
713
-
714
- if ('writable' in descriptor) {
715
- descriptor.writable = false;
716
- return;
717
- }
718
-
719
- if (!descriptor.set) {
720
- descriptor.set = () => {
721
- throw Error("Can not rewrite read-only method '" + name + "'");
722
- };
723
- }
724
- });
725
- };
726
-
727
- /**
728
- * Converts an array or a delimited string into an object set with values as keys and true as values.
729
- * Useful for fast membership checks.
730
- *
731
- * @param {Array|string} arrayOrString - The array or string to convert.
732
- * @param {string} delimiter - The delimiter to use if input is a string.
733
- * @returns {Object} An object with keys from the array or string, values set to true.
734
- */
735
- const toObjectSet = (arrayOrString, delimiter) => {
736
- const obj = {};
737
-
738
- const define = (arr) => {
739
- arr.forEach((value) => {
740
- obj[value] = true;
741
- });
742
- };
743
-
744
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
745
-
746
- return obj;
747
- };
748
-
749
- const noop = () => {};
750
-
751
- const toFiniteNumber = (value, defaultValue) => {
752
- return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
753
- };
754
-
755
- /**
756
- * If the thing is a FormData object, return true, otherwise return false.
757
- *
758
- * @param {unknown} thing - The thing to check.
759
- *
760
- * @returns {boolean}
761
- */
762
- function isSpecCompliantForm(thing) {
763
- return !!(
764
- thing &&
765
- isFunction$1(thing.append) &&
766
- thing[toStringTag] === 'FormData' &&
767
- thing[iterator]
768
- );
769
- }
770
-
771
- /**
772
- * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
773
- *
774
- * @param {Object} obj - The object to convert.
775
- * @returns {Object} The JSON-compatible object.
776
- */
777
- const toJSONObject = (obj) => {
778
- const stack = new Array(10);
779
-
780
- const visit = (source, i) => {
781
- if (isObject(source)) {
782
- if (stack.indexOf(source) >= 0) {
783
- return;
784
- }
785
-
786
- //Buffer check
787
- if (isBuffer(source)) {
788
- return source;
789
- }
790
-
791
- if (!('toJSON' in source)) {
792
- stack[i] = source;
793
- const target = isArray(source) ? [] : {};
794
-
795
- forEach(source, (value, key) => {
796
- const reducedValue = visit(value, i + 1);
797
- !isUndefined(reducedValue) && (target[key] = reducedValue);
798
- });
799
-
800
- stack[i] = undefined;
801
-
802
- return target;
803
- }
804
- }
805
-
806
- return source;
807
- };
808
-
809
- return visit(obj, 0);
810
- };
811
-
812
- /**
813
- * Determines if a value is an async function.
814
- *
815
- * @param {*} thing - The value to test.
816
- * @returns {boolean} True if value is an async function, otherwise false.
817
- */
818
- const isAsyncFn = kindOfTest('AsyncFunction');
819
-
820
- /**
821
- * Determines if a value is thenable (has then and catch methods).
822
- *
823
- * @param {*} thing - The value to test.
824
- * @returns {boolean} True if value is thenable, otherwise false.
825
- */
826
- const isThenable = (thing) =>
827
- thing &&
828
- (isObject(thing) || isFunction$1(thing)) &&
829
- isFunction$1(thing.then) &&
830
- isFunction$1(thing.catch);
831
-
832
- // original code
833
- // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
834
-
835
- /**
836
- * Provides a cross-platform setImmediate implementation.
837
- * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
838
- *
839
- * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
840
- * @param {boolean} postMessageSupported - Whether postMessage is supported.
841
- * @returns {Function} A function to schedule a callback asynchronously.
842
- */
843
- const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
844
- if (setImmediateSupported) {
845
- return setImmediate;
846
- }
847
-
848
- return postMessageSupported
849
- ? ((token, callbacks) => {
850
- _global.addEventListener(
851
- 'message',
852
- ({ source, data }) => {
853
- if (source === _global && data === token) {
854
- callbacks.length && callbacks.shift()();
855
- }
856
- },
857
- false
858
- );
859
-
860
- return (cb) => {
861
- callbacks.push(cb);
862
- _global.postMessage(token, '*');
863
- };
864
- })(`axios@${Math.random()}`, [])
865
- : (cb) => setTimeout(cb);
866
- })(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
867
-
868
- /**
869
- * Schedules a microtask or asynchronous callback as soon as possible.
870
- * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
871
- *
872
- * @type {Function}
873
- */
874
- const asap =
875
- typeof queueMicrotask !== 'undefined'
876
- ? queueMicrotask.bind(_global)
877
- : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
878
-
879
- // *********************
880
-
881
- const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
882
-
883
- var utils$1 = {
884
- isArray,
885
- isArrayBuffer,
886
- isBuffer,
887
- isFormData,
888
- isArrayBufferView,
889
- isString,
890
- isNumber,
891
- isBoolean,
892
- isObject,
893
- isPlainObject,
894
- isEmptyObject,
895
- isReadableStream,
896
- isRequest,
897
- isResponse,
898
- isHeaders,
899
- isUndefined,
900
- isDate,
901
- isFile,
902
- isReactNativeBlob,
903
- isReactNative,
904
- isBlob,
905
- isRegExp,
906
- isFunction: isFunction$1,
907
- isStream,
908
- isURLSearchParams,
909
- isTypedArray,
910
- isFileList,
911
- forEach,
912
- merge,
913
- extend,
914
- trim,
915
- stripBOM,
916
- inherits,
917
- toFlatObject,
918
- kindOf,
919
- kindOfTest,
920
- endsWith,
921
- toArray,
922
- forEachEntry,
923
- matchAll,
924
- isHTMLForm,
925
- hasOwnProperty,
926
- hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
927
- reduceDescriptors,
928
- freezeMethods,
929
- toObjectSet,
930
- toCamelCase,
931
- noop,
932
- toFiniteNumber,
933
- findKey,
934
- global: _global,
935
- isContextDefined,
936
- isSpecCompliantForm,
937
- toJSONObject,
938
- isAsyncFn,
939
- isThenable,
940
- setImmediate: _setImmediate,
941
- asap,
942
- isIterable,
943
- };
944
-
945
- // RawAxiosHeaders whose duplicates are ignored by node
946
- // c.f. https://nodejs.org/api/http.html#http_message_headers
947
- const ignoreDuplicateOf = utils$1.toObjectSet([
948
- 'age',
949
- 'authorization',
950
- 'content-length',
951
- 'content-type',
952
- 'etag',
953
- 'expires',
954
- 'from',
955
- 'host',
956
- 'if-modified-since',
957
- 'if-unmodified-since',
958
- 'last-modified',
959
- 'location',
960
- 'max-forwards',
961
- 'proxy-authorization',
962
- 'referer',
963
- 'retry-after',
964
- 'user-agent',
965
- ]);
966
-
967
- /**
968
- * Parse headers into an object
969
- *
970
- * ```
971
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
972
- * Content-Type: application/json
973
- * Connection: keep-alive
974
- * Transfer-Encoding: chunked
975
- * ```
976
- *
977
- * @param {String} rawHeaders Headers needing to be parsed
978
- *
979
- * @returns {Object} Headers parsed into an object
980
- */
981
- var parseHeaders = (rawHeaders) => {
982
- const parsed = {};
983
- let key;
984
- let val;
985
- let i;
986
-
987
- rawHeaders &&
988
- rawHeaders.split('\n').forEach(function parser(line) {
989
- i = line.indexOf(':');
990
- key = line.substring(0, i).trim().toLowerCase();
991
- val = line.substring(i + 1).trim();
992
-
993
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
994
- return;
995
- }
996
-
997
- if (key === 'set-cookie') {
998
- if (parsed[key]) {
999
- parsed[key].push(val);
1000
- } else {
1001
- parsed[key] = [val];
1002
- }
1003
- } else {
1004
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1005
- }
1006
- });
1007
-
1008
- return parsed;
1009
- };
1010
-
1011
- const $internals = Symbol('internals');
1012
-
1013
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1014
-
1015
- function trimSPorHTAB(str) {
1016
- let start = 0;
1017
- let end = str.length;
1018
-
1019
- while (start < end) {
1020
- const code = str.charCodeAt(start);
1021
-
1022
- if (code !== 0x09 && code !== 0x20) {
1023
- break;
1024
- }
1025
-
1026
- start += 1;
1027
- }
1028
-
1029
- while (end > start) {
1030
- const code = str.charCodeAt(end - 1);
1031
-
1032
- if (code !== 0x09 && code !== 0x20) {
1033
- break;
1034
- }
1035
-
1036
- end -= 1;
1037
- }
1038
-
1039
- return start === 0 && end === str.length ? str : str.slice(start, end);
1040
- }
1041
-
1042
- function normalizeHeader(header) {
1043
- return header && String(header).trim().toLowerCase();
1044
- }
1045
-
1046
- function sanitizeHeaderValue(str) {
1047
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1048
- }
1049
-
1050
- function normalizeValue(value) {
1051
- if (value === false || value == null) {
1052
- return value;
1053
- }
1054
-
1055
- return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1056
- }
1057
-
1058
- function parseTokens(str) {
1059
- const tokens = Object.create(null);
1060
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1061
- let match;
1062
-
1063
- while ((match = tokensRE.exec(str))) {
1064
- tokens[match[1]] = match[2];
1065
- }
1066
-
1067
- return tokens;
1068
- }
1069
-
1070
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1071
-
1072
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1073
- if (utils$1.isFunction(filter)) {
1074
- return filter.call(this, value, header);
1075
- }
1076
-
1077
- if (isHeaderNameFilter) {
1078
- value = header;
1079
- }
1080
-
1081
- if (!utils$1.isString(value)) return;
1082
-
1083
- if (utils$1.isString(filter)) {
1084
- return value.indexOf(filter) !== -1;
1085
- }
1086
-
1087
- if (utils$1.isRegExp(filter)) {
1088
- return filter.test(value);
1089
- }
1090
- }
1091
-
1092
- function formatHeader(header) {
1093
- return header
1094
- .trim()
1095
- .toLowerCase()
1096
- .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1097
- return char.toUpperCase() + str;
1098
- });
1099
- }
1100
-
1101
- function buildAccessors(obj, header) {
1102
- const accessorName = utils$1.toCamelCase(' ' + header);
1103
-
1104
- ['get', 'set', 'has'].forEach((methodName) => {
1105
- Object.defineProperty(obj, methodName + accessorName, {
1106
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1107
- // this data descriptor into an accessor descriptor on the way in.
1108
- __proto__: null,
1109
- value: function (arg1, arg2, arg3) {
1110
- return this[methodName].call(this, header, arg1, arg2, arg3);
1111
- },
1112
- configurable: true,
1113
- });
1114
- });
1115
- }
1116
-
1117
- class AxiosHeaders {
1118
- constructor(headers) {
1119
- headers && this.set(headers);
1120
- }
1121
-
1122
- set(header, valueOrRewrite, rewrite) {
1123
- const self = this;
1124
-
1125
- function setHeader(_value, _header, _rewrite) {
1126
- const lHeader = normalizeHeader(_header);
1127
-
1128
- if (!lHeader) {
1129
- throw new Error('header name must be a non-empty string');
1130
- }
1131
-
1132
- const key = utils$1.findKey(self, lHeader);
1133
-
1134
- if (
1135
- !key ||
1136
- self[key] === undefined ||
1137
- _rewrite === true ||
1138
- (_rewrite === undefined && self[key] !== false)
1139
- ) {
1140
- self[key || _header] = normalizeValue(_value);
1141
- }
1142
- }
1143
-
1144
- const setHeaders = (headers, _rewrite) =>
1145
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1146
-
1147
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1148
- setHeaders(header, valueOrRewrite);
1149
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1150
- setHeaders(parseHeaders(header), valueOrRewrite);
1151
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1152
- let obj = {},
1153
- dest,
1154
- key;
1155
- for (const entry of header) {
1156
- if (!utils$1.isArray(entry)) {
1157
- throw TypeError('Object iterator must return a key-value pair');
1158
- }
1159
-
1160
- obj[(key = entry[0])] = (dest = obj[key])
1161
- ? utils$1.isArray(dest)
1162
- ? [...dest, entry[1]]
1163
- : [dest, entry[1]]
1164
- : entry[1];
1165
- }
1166
-
1167
- setHeaders(obj, valueOrRewrite);
1168
- } else {
1169
- header != null && setHeader(valueOrRewrite, header, rewrite);
1170
- }
1171
-
1172
- return this;
1173
- }
1174
-
1175
- get(header, parser) {
1176
- header = normalizeHeader(header);
1177
-
1178
- if (header) {
1179
- const key = utils$1.findKey(this, header);
1180
-
1181
- if (key) {
1182
- const value = this[key];
1183
-
1184
- if (!parser) {
1185
- return value;
1186
- }
1187
-
1188
- if (parser === true) {
1189
- return parseTokens(value);
1190
- }
1191
-
1192
- if (utils$1.isFunction(parser)) {
1193
- return parser.call(this, value, key);
1194
- }
1195
-
1196
- if (utils$1.isRegExp(parser)) {
1197
- return parser.exec(value);
1198
- }
1199
-
1200
- throw new TypeError('parser must be boolean|regexp|function');
1201
- }
1202
- }
1203
- }
1204
-
1205
- has(header, matcher) {
1206
- header = normalizeHeader(header);
1207
-
1208
- if (header) {
1209
- const key = utils$1.findKey(this, header);
1210
-
1211
- return !!(
1212
- key &&
1213
- this[key] !== undefined &&
1214
- (!matcher || matchHeaderValue(this, this[key], key, matcher))
1215
- );
1216
- }
1217
-
1218
- return false;
1219
- }
1220
-
1221
- delete(header, matcher) {
1222
- const self = this;
1223
- let deleted = false;
1224
-
1225
- function deleteHeader(_header) {
1226
- _header = normalizeHeader(_header);
1227
-
1228
- if (_header) {
1229
- const key = utils$1.findKey(self, _header);
1230
-
1231
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1232
- delete self[key];
1233
-
1234
- deleted = true;
1235
- }
1236
- }
1237
- }
1238
-
1239
- if (utils$1.isArray(header)) {
1240
- header.forEach(deleteHeader);
1241
- } else {
1242
- deleteHeader(header);
1243
- }
1244
-
1245
- return deleted;
1246
- }
1247
-
1248
- clear(matcher) {
1249
- const keys = Object.keys(this);
1250
- let i = keys.length;
1251
- let deleted = false;
1252
-
1253
- while (i--) {
1254
- const key = keys[i];
1255
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1256
- delete this[key];
1257
- deleted = true;
1258
- }
1259
- }
1260
-
1261
- return deleted;
1262
- }
1263
-
1264
- normalize(format) {
1265
- const self = this;
1266
- const headers = {};
1267
-
1268
- utils$1.forEach(this, (value, header) => {
1269
- const key = utils$1.findKey(headers, header);
1270
-
1271
- if (key) {
1272
- self[key] = normalizeValue(value);
1273
- delete self[header];
1274
- return;
1275
- }
1276
-
1277
- const normalized = format ? formatHeader(header) : String(header).trim();
1278
-
1279
- if (normalized !== header) {
1280
- delete self[header];
1281
- }
1282
-
1283
- self[normalized] = normalizeValue(value);
1284
-
1285
- headers[normalized] = true;
1286
- });
1287
-
1288
- return this;
1289
- }
1290
-
1291
- concat(...targets) {
1292
- return this.constructor.concat(this, ...targets);
1293
- }
1294
-
1295
- toJSON(asStrings) {
1296
- const obj = Object.create(null);
1297
-
1298
- utils$1.forEach(this, (value, header) => {
1299
- value != null &&
1300
- value !== false &&
1301
- (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1302
- });
1303
-
1304
- return obj;
1305
- }
1306
-
1307
- [Symbol.iterator]() {
1308
- return Object.entries(this.toJSON())[Symbol.iterator]();
1309
- }
1310
-
1311
- toString() {
1312
- return Object.entries(this.toJSON())
1313
- .map(([header, value]) => header + ': ' + value)
1314
- .join('\n');
1315
- }
1316
-
1317
- getSetCookie() {
1318
- return this.get('set-cookie') || [];
1319
- }
1320
-
1321
- get [Symbol.toStringTag]() {
1322
- return 'AxiosHeaders';
1323
- }
1324
-
1325
- static from(thing) {
1326
- return thing instanceof this ? thing : new this(thing);
1327
- }
1328
-
1329
- static concat(first, ...targets) {
1330
- const computed = new this(first);
1331
-
1332
- targets.forEach((target) => computed.set(target));
1333
-
1334
- return computed;
1335
- }
1336
-
1337
- static accessor(header) {
1338
- const internals =
1339
- (this[$internals] =
1340
- this[$internals] =
1341
- {
1342
- accessors: {},
1343
- });
1344
-
1345
- const accessors = internals.accessors;
1346
- const prototype = this.prototype;
1347
-
1348
- function defineAccessor(_header) {
1349
- const lHeader = normalizeHeader(_header);
1350
-
1351
- if (!accessors[lHeader]) {
1352
- buildAccessors(prototype, _header);
1353
- accessors[lHeader] = true;
1354
- }
1355
- }
1356
-
1357
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1358
-
1359
- return this;
1360
- }
1361
- }
1362
-
1363
- AxiosHeaders.accessor([
1364
- 'Content-Type',
1365
- 'Content-Length',
1366
- 'Accept',
1367
- 'Accept-Encoding',
1368
- 'User-Agent',
1369
- 'Authorization',
1370
- ]);
1371
-
1372
- // reserved names hotfix
1373
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
1374
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1375
- return {
1376
- get: () => value,
1377
- set(headerValue) {
1378
- this[mapped] = headerValue;
1379
- },
1380
- };
1381
- });
1382
-
1383
- utils$1.freezeMethods(AxiosHeaders);
1384
-
1385
- const REDACTED = '[REDACTED ****]';
1386
-
1387
- function hasOwnOrPrototypeToJSON(source) {
1388
- if (utils$1.hasOwnProp(source, 'toJSON')) {
1389
- return true;
1390
- }
1391
-
1392
- let prototype = Object.getPrototypeOf(source);
1393
-
1394
- while (prototype && prototype !== Object.prototype) {
1395
- if (utils$1.hasOwnProp(prototype, 'toJSON')) {
1396
- return true;
1397
- }
1398
-
1399
- prototype = Object.getPrototypeOf(prototype);
1400
- }
1401
-
1402
- return false;
1403
- }
1404
-
1405
- // Build a plain-object snapshot of `config` and replace the value of any key
1406
- // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
1407
- // and AxiosHeaders, and short-circuits on circular references.
1408
- function redactConfig(config, redactKeys) {
1409
- const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
1410
- const seen = [];
1411
-
1412
- const visit = (source) => {
1413
- if (source === null || typeof source !== 'object') return source;
1414
- if (utils$1.isBuffer(source)) return source;
1415
- if (seen.indexOf(source) !== -1) return undefined;
1416
-
1417
- if (source instanceof AxiosHeaders) {
1418
- source = source.toJSON();
1419
- }
1420
-
1421
- seen.push(source);
1422
-
1423
- let result;
1424
- if (utils$1.isArray(source)) {
1425
- result = [];
1426
- source.forEach((v, i) => {
1427
- const reducedValue = visit(v);
1428
- if (!utils$1.isUndefined(reducedValue)) {
1429
- result[i] = reducedValue;
1430
- }
1431
- });
1432
- } else {
1433
- if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
1434
- seen.pop();
1435
- return source;
1436
- }
1437
-
1438
- result = Object.create(null);
1439
- for (const [key, value] of Object.entries(source)) {
1440
- const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
1441
- if (!utils$1.isUndefined(reducedValue)) {
1442
- result[key] = reducedValue;
1443
- }
1444
- }
1445
- }
1446
-
1447
- seen.pop();
1448
- return result;
1449
- };
1450
-
1451
- return visit(config);
1452
- }
1453
-
1454
- class AxiosError extends Error {
1455
- static from(error, code, config, request, response, customProps) {
1456
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1457
- axiosError.cause = error;
1458
- axiosError.name = error.name;
1459
-
1460
- // Preserve status from the original error if not already set from response
1461
- if (error.status != null && axiosError.status == null) {
1462
- axiosError.status = error.status;
1463
- }
1464
-
1465
- customProps && Object.assign(axiosError, customProps);
1466
- return axiosError;
1467
- }
1468
-
1469
- /**
1470
- * Create an Error with the specified message, config, error code, request and response.
1471
- *
1472
- * @param {string} message The error message.
1473
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
1474
- * @param {Object} [config] The config.
1475
- * @param {Object} [request] The request.
1476
- * @param {Object} [response] The response.
1477
- *
1478
- * @returns {Error} The created error.
1479
- */
1480
- constructor(message, code, config, request, response) {
1481
- super(message);
1482
-
1483
- // Make message enumerable to maintain backward compatibility
1484
- // The native Error constructor sets message as non-enumerable,
1485
- // but axios < v1.13.3 had it as enumerable
1486
- Object.defineProperty(this, 'message', {
1487
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1488
- // this data descriptor into an accessor descriptor on the way in.
1489
- __proto__: null,
1490
- value: message,
1491
- enumerable: true,
1492
- writable: true,
1493
- configurable: true,
1494
- });
1495
-
1496
- this.name = 'AxiosError';
1497
- this.isAxiosError = true;
1498
- code && (this.code = code);
1499
- config && (this.config = config);
1500
- request && (this.request = request);
1501
- if (response) {
1502
- this.response = response;
1503
- this.status = response.status;
1504
- }
1505
- }
1506
-
1507
- toJSON() {
1508
- // Opt-in redaction: when the request config carries a `redact` array, the
1509
- // value of any matching key (case-insensitive, at any depth) is replaced
1510
- // with REDACTED in the serialized snapshot. Undefined or empty leaves the
1511
- // existing serialization behavior unchanged.
1512
- const config = this.config;
1513
- const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
1514
- const serializedConfig =
1515
- utils$1.isArray(redactKeys) && redactKeys.length > 0
1516
- ? redactConfig(config, redactKeys)
1517
- : utils$1.toJSONObject(config);
1518
-
1519
- return {
1520
- // Standard
1521
- message: this.message,
1522
- name: this.name,
1523
- // Microsoft
1524
- description: this.description,
1525
- number: this.number,
1526
- // Mozilla
1527
- fileName: this.fileName,
1528
- lineNumber: this.lineNumber,
1529
- columnNumber: this.columnNumber,
1530
- stack: this.stack,
1531
- // Axios
1532
- config: serializedConfig,
1533
- code: this.code,
1534
- status: this.status,
1535
- };
1536
- }
1537
- }
1538
-
1539
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1540
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1541
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1542
- AxiosError.ECONNABORTED = 'ECONNABORTED';
1543
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1544
- AxiosError.ECONNREFUSED = 'ECONNREFUSED';
1545
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1546
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1547
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1548
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1549
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1550
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1551
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1552
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1553
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1554
-
1555
- // eslint-disable-next-line strict
1556
- var httpAdapter = null;
1557
-
1558
- /**
1559
- * Determines if the given thing is a array or js object.
1560
- *
1561
- * @param {string} thing - The object or array to be visited.
1562
- *
1563
- * @returns {boolean}
1564
- */
1565
- function isVisitable(thing) {
1566
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1567
- }
1568
-
1569
- /**
1570
- * It removes the brackets from the end of a string
1571
- *
1572
- * @param {string} key - The key of the parameter.
1573
- *
1574
- * @returns {string} the key without the brackets.
1575
- */
1576
- function removeBrackets(key) {
1577
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1578
- }
1579
-
1580
- /**
1581
- * It takes a path, a key, and a boolean, and returns a string
1582
- *
1583
- * @param {string} path - The path to the current key.
1584
- * @param {string} key - The key of the current object being iterated over.
1585
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1586
- *
1587
- * @returns {string} The path to the current key.
1588
- */
1589
- function renderKey(path, key, dots) {
1590
- if (!path) return key;
1591
- return path
1592
- .concat(key)
1593
- .map(function each(token, i) {
1594
- // eslint-disable-next-line no-param-reassign
1595
- token = removeBrackets(token);
1596
- return !dots && i ? '[' + token + ']' : token;
1597
- })
1598
- .join(dots ? '.' : '');
1599
- }
1600
-
1601
- /**
1602
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1603
- *
1604
- * @param {Array<any>} arr - The array to check
1605
- *
1606
- * @returns {boolean}
1607
- */
1608
- function isFlatArray(arr) {
1609
- return utils$1.isArray(arr) && !arr.some(isVisitable);
1610
- }
1611
-
1612
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1613
- return /^is[A-Z]/.test(prop);
1614
- });
1615
-
1616
- /**
1617
- * Convert a data object to FormData
1618
- *
1619
- * @param {Object} obj
1620
- * @param {?Object} [formData]
1621
- * @param {?Object} [options]
1622
- * @param {Function} [options.visitor]
1623
- * @param {Boolean} [options.metaTokens = true]
1624
- * @param {Boolean} [options.dots = false]
1625
- * @param {?Boolean} [options.indexes = false]
1626
- *
1627
- * @returns {Object}
1628
- **/
1629
-
1630
- /**
1631
- * It converts an object into a FormData object
1632
- *
1633
- * @param {Object<any, any>} obj - The object to convert to form data.
1634
- * @param {string} formData - The FormData object to append to.
1635
- * @param {Object<string, any>} options
1636
- *
1637
- * @returns
1638
- */
1639
- function toFormData(obj, formData, options) {
1640
- if (!utils$1.isObject(obj)) {
1641
- throw new TypeError('target must be an object');
1642
- }
1643
-
1644
- // eslint-disable-next-line no-param-reassign
1645
- formData = formData || new (FormData)();
1646
-
1647
- // eslint-disable-next-line no-param-reassign
1648
- options = utils$1.toFlatObject(
1649
- options,
1650
- {
1651
- metaTokens: true,
1652
- dots: false,
1653
- indexes: false,
1654
- },
1655
- false,
1656
- function defined(option, source) {
1657
- // eslint-disable-next-line no-eq-null,eqeqeq
1658
- return !utils$1.isUndefined(source[option]);
1659
- }
1660
- );
1661
-
1662
- const metaTokens = options.metaTokens;
1663
- // eslint-disable-next-line no-use-before-define
1664
- const visitor = options.visitor || defaultVisitor;
1665
- const dots = options.dots;
1666
- const indexes = options.indexes;
1667
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1668
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1669
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1670
-
1671
- if (!utils$1.isFunction(visitor)) {
1672
- throw new TypeError('visitor must be a function');
1673
- }
1674
-
1675
- function convertValue(value) {
1676
- if (value === null) return '';
1677
-
1678
- if (utils$1.isDate(value)) {
1679
- return value.toISOString();
1680
- }
1681
-
1682
- if (utils$1.isBoolean(value)) {
1683
- return value.toString();
1684
- }
1685
-
1686
- if (!useBlob && utils$1.isBlob(value)) {
1687
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1688
- }
1689
-
1690
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1691
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1692
- }
1693
-
1694
- return value;
1695
- }
1696
-
1697
- /**
1698
- * Default visitor.
1699
- *
1700
- * @param {*} value
1701
- * @param {String|Number} key
1702
- * @param {Array<String|Number>} path
1703
- * @this {FormData}
1704
- *
1705
- * @returns {boolean} return true to visit the each prop of the value recursively
1706
- */
1707
- function defaultVisitor(value, key, path) {
1708
- let arr = value;
1709
-
1710
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1711
- formData.append(renderKey(path, key, dots), convertValue(value));
1712
- return false;
1713
- }
1714
-
1715
- if (value && !path && typeof value === 'object') {
1716
- if (utils$1.endsWith(key, '{}')) {
1717
- // eslint-disable-next-line no-param-reassign
1718
- key = metaTokens ? key : key.slice(0, -2);
1719
- // eslint-disable-next-line no-param-reassign
1720
- value = JSON.stringify(value);
1721
- } else if (
1722
- (utils$1.isArray(value) && isFlatArray(value)) ||
1723
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
1724
- ) {
1725
- // eslint-disable-next-line no-param-reassign
1726
- key = removeBrackets(key);
1727
-
1728
- arr.forEach(function each(el, index) {
1729
- !(utils$1.isUndefined(el) || el === null) &&
1730
- formData.append(
1731
- // eslint-disable-next-line no-nested-ternary
1732
- indexes === true
1733
- ? renderKey([key], index, dots)
1734
- : indexes === null
1735
- ? key
1736
- : key + '[]',
1737
- convertValue(el)
1738
- );
1739
- });
1740
- return false;
1741
- }
1742
- }
1743
-
1744
- if (isVisitable(value)) {
1745
- return true;
1746
- }
1747
-
1748
- formData.append(renderKey(path, key, dots), convertValue(value));
1749
-
1750
- return false;
1751
- }
1752
-
1753
- const stack = [];
1754
-
1755
- const exposedHelpers = Object.assign(predicates, {
1756
- defaultVisitor,
1757
- convertValue,
1758
- isVisitable,
1759
- });
1760
-
1761
- function build(value, path, depth = 0) {
1762
- if (utils$1.isUndefined(value)) return;
1763
-
1764
- if (depth > maxDepth) {
1765
- throw new AxiosError(
1766
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1767
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
1768
- );
1769
- }
1770
-
1771
- if (stack.indexOf(value) !== -1) {
1772
- throw Error('Circular reference detected in ' + path.join('.'));
1773
- }
1774
-
1775
- stack.push(value);
1776
-
1777
- utils$1.forEach(value, function each(el, key) {
1778
- const result =
1779
- !(utils$1.isUndefined(el) || el === null) &&
1780
- visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1781
-
1782
- if (result === true) {
1783
- build(el, path ? path.concat(key) : [key], depth + 1);
1784
- }
1785
- });
1786
-
1787
- stack.pop();
1788
- }
1789
-
1790
- if (!utils$1.isObject(obj)) {
1791
- throw new TypeError('data must be an object');
1792
- }
1793
-
1794
- build(obj);
1795
-
1796
- return formData;
1797
- }
1798
-
1799
- /**
1800
- * It encodes a string by replacing all characters that are not in the unreserved set with
1801
- * their percent-encoded equivalents
1802
- *
1803
- * @param {string} str - The string to encode.
1804
- *
1805
- * @returns {string} The encoded string.
1806
- */
1807
- function encode$1(str) {
1808
- const charMap = {
1809
- '!': '%21',
1810
- "'": '%27',
1811
- '(': '%28',
1812
- ')': '%29',
1813
- '~': '%7E',
1814
- '%20': '+',
1815
- };
1816
- return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
1817
- return charMap[match];
1818
- });
1819
- }
1820
-
1821
- /**
1822
- * It takes a params object and converts it to a FormData object
1823
- *
1824
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1825
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1826
- *
1827
- * @returns {void}
1828
- */
1829
- function AxiosURLSearchParams(params, options) {
1830
- this._pairs = [];
1831
-
1832
- params && toFormData(params, this, options);
1833
- }
1834
-
1835
- const prototype = AxiosURLSearchParams.prototype;
1836
-
1837
- prototype.append = function append(name, value) {
1838
- this._pairs.push([name, value]);
1839
- };
1840
-
1841
- prototype.toString = function toString(encoder) {
1842
- const _encode = encoder
1843
- ? function (value) {
1844
- return encoder.call(this, value, encode$1);
1845
- }
1846
- : encode$1;
1847
-
1848
- return this._pairs
1849
- .map(function each(pair) {
1850
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1851
- }, '')
1852
- .join('&');
1853
- };
1854
-
1855
- /**
1856
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1857
- * their plain counterparts (`:`, `$`, `,`, `+`).
1858
- *
1859
- * @param {string} val The value to be encoded.
1860
- *
1861
- * @returns {string} The encoded value.
1862
- */
1863
- function encode(val) {
1864
- return encodeURIComponent(val)
1865
- .replace(/%3A/gi, ':')
1866
- .replace(/%24/g, '$')
1867
- .replace(/%2C/gi, ',')
1868
- .replace(/%20/g, '+');
1869
- }
1870
-
1871
- /**
1872
- * Build a URL by appending params to the end
1873
- *
1874
- * @param {string} url The base of the url (e.g., http://www.google.com)
1875
- * @param {object} [params] The params to be appended
1876
- * @param {?(object|Function)} options
1877
- *
1878
- * @returns {string} The formatted url
1879
- */
1880
- function buildURL(url, params, options) {
1881
- if (!params) {
1882
- return url;
1883
- }
1884
-
1885
- const _encode = (options && options.encode) || encode;
1886
-
1887
- const _options = utils$1.isFunction(options)
1888
- ? {
1889
- serialize: options,
1890
- }
1891
- : options;
1892
-
1893
- const serializeFn = _options && _options.serialize;
1894
-
1895
- let serializedParams;
1896
-
1897
- if (serializeFn) {
1898
- serializedParams = serializeFn(params, _options);
1899
- } else {
1900
- serializedParams = utils$1.isURLSearchParams(params)
1901
- ? params.toString()
1902
- : new AxiosURLSearchParams(params, _options).toString(_encode);
1903
- }
1904
-
1905
- if (serializedParams) {
1906
- const hashmarkIndex = url.indexOf('#');
1907
-
1908
- if (hashmarkIndex !== -1) {
1909
- url = url.slice(0, hashmarkIndex);
1910
- }
1911
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1912
- }
1913
-
1914
- return url;
1915
- }
1916
-
1917
- class InterceptorManager {
1918
- constructor() {
1919
- this.handlers = [];
1920
- }
1921
-
1922
- /**
1923
- * Add a new interceptor to the stack
1924
- *
1925
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1926
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1927
- * @param {Object} options The options for the interceptor, synchronous and runWhen
1928
- *
1929
- * @return {Number} An ID used to remove interceptor later
1930
- */
1931
- use(fulfilled, rejected, options) {
1932
- this.handlers.push({
1933
- fulfilled,
1934
- rejected,
1935
- synchronous: options ? options.synchronous : false,
1936
- runWhen: options ? options.runWhen : null,
1937
- });
1938
- return this.handlers.length - 1;
1939
- }
1940
-
1941
- /**
1942
- * Remove an interceptor from the stack
1943
- *
1944
- * @param {Number} id The ID that was returned by `use`
1945
- *
1946
- * @returns {void}
1947
- */
1948
- eject(id) {
1949
- if (this.handlers[id]) {
1950
- this.handlers[id] = null;
1951
- }
1952
- }
1953
-
1954
- /**
1955
- * Clear all interceptors from the stack
1956
- *
1957
- * @returns {void}
1958
- */
1959
- clear() {
1960
- if (this.handlers) {
1961
- this.handlers = [];
1962
- }
1963
- }
1964
-
1965
- /**
1966
- * Iterate over all the registered interceptors
1967
- *
1968
- * This method is particularly useful for skipping over any
1969
- * interceptors that may have become `null` calling `eject`.
1970
- *
1971
- * @param {Function} fn The function to call for each interceptor
1972
- *
1973
- * @returns {void}
1974
- */
1975
- forEach(fn) {
1976
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1977
- if (h !== null) {
1978
- fn(h);
1979
- }
1980
- });
1981
- }
1982
- }
1983
-
1984
- var transitionalDefaults = {
1985
- silentJSONParsing: true,
1986
- forcedJSONParsing: true,
1987
- clarifyTimeoutError: false,
1988
- legacyInterceptorReqResOrdering: true,
1989
- };
1990
-
1991
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1992
-
1993
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1994
-
1995
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1996
-
1997
- var platform$1 = {
1998
- isBrowser: true,
1999
- classes: {
2000
- URLSearchParams: URLSearchParams$1,
2001
- FormData: FormData$1,
2002
- Blob: Blob$1,
2003
- },
2004
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
2005
- };
2006
-
2007
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2008
-
2009
- const _navigator = (typeof navigator === 'object' && navigator) || undefined;
2010
-
2011
- /**
2012
- * Determine if we're running in a standard browser environment
2013
- *
2014
- * This allows axios to run in a web worker, and react-native.
2015
- * Both environments support XMLHttpRequest, but not fully standard globals.
2016
- *
2017
- * web workers:
2018
- * typeof window -> undefined
2019
- * typeof document -> undefined
2020
- *
2021
- * react-native:
2022
- * navigator.product -> 'ReactNative'
2023
- * nativescript
2024
- * navigator.product -> 'NativeScript' or 'NS'
2025
- *
2026
- * @returns {boolean}
2027
- */
2028
- const hasStandardBrowserEnv =
2029
- hasBrowserEnv &&
2030
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2031
-
2032
- /**
2033
- * Determine if we're running in a standard browser webWorker environment
2034
- *
2035
- * Although the `isStandardBrowserEnv` method indicates that
2036
- * `allows axios to run in a web worker`, the WebWorker will still be
2037
- * filtered out due to its judgment standard
2038
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2039
- * This leads to a problem when axios post `FormData` in webWorker
2040
- */
2041
- const hasStandardBrowserWebWorkerEnv = (() => {
2042
- return (
2043
- typeof WorkerGlobalScope !== 'undefined' &&
2044
- // eslint-disable-next-line no-undef
2045
- self instanceof WorkerGlobalScope &&
2046
- typeof self.importScripts === 'function'
2047
- );
2048
- })();
2049
-
2050
- const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
2051
-
2052
- var utils = /*#__PURE__*/Object.freeze({
2053
- __proto__: null,
2054
- hasBrowserEnv: hasBrowserEnv,
2055
- hasStandardBrowserEnv: hasStandardBrowserEnv,
2056
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2057
- navigator: _navigator,
2058
- origin: origin
2059
- });
2060
-
2061
- var platform = {
2062
- ...utils,
2063
- ...platform$1,
2064
- };
2065
-
2066
- function toURLEncodedForm(data, options) {
2067
- return toFormData(data, new platform.classes.URLSearchParams(), {
2068
- visitor: function (value, key, path, helpers) {
2069
- if (platform.isNode && utils$1.isBuffer(value)) {
2070
- this.append(key, value.toString('base64'));
2071
- return false;
2072
- }
2073
-
2074
- return helpers.defaultVisitor.apply(this, arguments);
2075
- },
2076
- ...options,
2077
- });
2078
- }
2079
-
2080
- /**
2081
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2082
- *
2083
- * @param {string} name - The name of the property to get.
2084
- *
2085
- * @returns An array of strings.
2086
- */
2087
- function parsePropPath(name) {
2088
- // foo[x][y][z]
2089
- // foo.x.y.z
2090
- // foo-x-y-z
2091
- // foo x y z
2092
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
2093
- return match[0] === '[]' ? '' : match[1] || match[0];
2094
- });
2095
- }
2096
-
2097
- /**
2098
- * Convert an array to an object.
2099
- *
2100
- * @param {Array<any>} arr - The array to convert to an object.
2101
- *
2102
- * @returns An object with the same keys and values as the array.
2103
- */
2104
- function arrayToObject(arr) {
2105
- const obj = {};
2106
- const keys = Object.keys(arr);
2107
- let i;
2108
- const len = keys.length;
2109
- let key;
2110
- for (i = 0; i < len; i++) {
2111
- key = keys[i];
2112
- obj[key] = arr[key];
2113
- }
2114
- return obj;
2115
- }
2116
-
2117
- /**
2118
- * It takes a FormData object and returns a JavaScript object
2119
- *
2120
- * @param {string} formData The FormData object to convert to JSON.
2121
- *
2122
- * @returns {Object<string, any> | null} The converted object.
2123
- */
2124
- function formDataToJSON(formData) {
2125
- function buildPath(path, value, target, index) {
2126
- let name = path[index++];
2127
-
2128
- if (name === '__proto__') return true;
2129
-
2130
- const isNumericKey = Number.isFinite(+name);
2131
- const isLast = index >= path.length;
2132
- name = !name && utils$1.isArray(target) ? target.length : name;
2133
-
2134
- if (isLast) {
2135
- if (utils$1.hasOwnProp(target, name)) {
2136
- target[name] = utils$1.isArray(target[name])
2137
- ? target[name].concat(value)
2138
- : [target[name], value];
2139
- } else {
2140
- target[name] = value;
2141
- }
2142
-
2143
- return !isNumericKey;
2144
- }
2145
-
2146
- if (!target[name] || !utils$1.isObject(target[name])) {
2147
- target[name] = [];
2148
- }
2149
-
2150
- const result = buildPath(path, value, target[name], index);
2151
-
2152
- if (result && utils$1.isArray(target[name])) {
2153
- target[name] = arrayToObject(target[name]);
2154
- }
2155
-
2156
- return !isNumericKey;
2157
- }
2158
-
2159
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2160
- const obj = {};
2161
-
2162
- utils$1.forEachEntry(formData, (name, value) => {
2163
- buildPath(parsePropPath(name), value, obj, 0);
2164
- });
2165
-
2166
- return obj;
2167
- }
2168
-
2169
- return null;
2170
- }
2171
-
2172
- const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
2173
-
2174
- /**
2175
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2176
- * of the input
2177
- *
2178
- * @param {any} rawValue - The value to be stringified.
2179
- * @param {Function} parser - A function that parses a string into a JavaScript object.
2180
- * @param {Function} encoder - A function that takes a value and returns a string.
2181
- *
2182
- * @returns {string} A stringified version of the rawValue.
2183
- */
2184
- function stringifySafely(rawValue, parser, encoder) {
2185
- if (utils$1.isString(rawValue)) {
2186
- try {
2187
- (parser || JSON.parse)(rawValue);
2188
- return utils$1.trim(rawValue);
2189
- } catch (e) {
2190
- if (e.name !== 'SyntaxError') {
2191
- throw e;
2192
- }
2193
- }
2194
- }
2195
-
2196
- return (encoder || JSON.stringify)(rawValue);
2197
- }
2198
-
2199
- const defaults = {
2200
- transitional: transitionalDefaults,
2201
-
2202
- adapter: ['xhr', 'http', 'fetch'],
2203
-
2204
- transformRequest: [
2205
- function transformRequest(data, headers) {
2206
- const contentType = headers.getContentType() || '';
2207
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
2208
- const isObjectPayload = utils$1.isObject(data);
2209
-
2210
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
2211
- data = new FormData(data);
2212
- }
2213
-
2214
- const isFormData = utils$1.isFormData(data);
2215
-
2216
- if (isFormData) {
2217
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2218
- }
2219
-
2220
- if (
2221
- utils$1.isArrayBuffer(data) ||
2222
- utils$1.isBuffer(data) ||
2223
- utils$1.isStream(data) ||
2224
- utils$1.isFile(data) ||
2225
- utils$1.isBlob(data) ||
2226
- utils$1.isReadableStream(data)
2227
- ) {
2228
- return data;
2229
- }
2230
- if (utils$1.isArrayBufferView(data)) {
2231
- return data.buffer;
2232
- }
2233
- if (utils$1.isURLSearchParams(data)) {
2234
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2235
- return data.toString();
2236
- }
2237
-
2238
- let isFileList;
2239
-
2240
- if (isObjectPayload) {
2241
- const formSerializer = own(this, 'formSerializer');
2242
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2243
- return toURLEncodedForm(data, formSerializer).toString();
2244
- }
2245
-
2246
- if (
2247
- (isFileList = utils$1.isFileList(data)) ||
2248
- contentType.indexOf('multipart/form-data') > -1
2249
- ) {
2250
- const env = own(this, 'env');
2251
- const _FormData = env && env.FormData;
2252
-
2253
- return toFormData(
2254
- isFileList ? { 'files[]': data } : data,
2255
- _FormData && new _FormData(),
2256
- formSerializer
2257
- );
2258
- }
2259
- }
2260
-
2261
- if (isObjectPayload || hasJSONContentType) {
2262
- headers.setContentType('application/json', false);
2263
- return stringifySafely(data);
2264
- }
2265
-
2266
- return data;
2267
- },
2268
- ],
2269
-
2270
- transformResponse: [
2271
- function transformResponse(data) {
2272
- const transitional = own(this, 'transitional') || defaults.transitional;
2273
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2274
- const responseType = own(this, 'responseType');
2275
- const JSONRequested = responseType === 'json';
2276
-
2277
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2278
- return data;
2279
- }
2280
-
2281
- if (
2282
- data &&
2283
- utils$1.isString(data) &&
2284
- ((forcedJSONParsing && !responseType) || JSONRequested)
2285
- ) {
2286
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
2287
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
2288
-
2289
- try {
2290
- return JSON.parse(data, own(this, 'parseReviver'));
2291
- } catch (e) {
2292
- if (strictJSONParsing) {
2293
- if (e.name === 'SyntaxError') {
2294
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
2295
- }
2296
- throw e;
2297
- }
2298
- }
2299
- }
2300
-
2301
- return data;
2302
- },
2303
- ],
2304
-
2305
- /**
2306
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2307
- * timeout is not created.
2308
- */
2309
- timeout: 0,
2310
-
2311
- xsrfCookieName: 'XSRF-TOKEN',
2312
- xsrfHeaderName: 'X-XSRF-TOKEN',
2313
-
2314
- maxContentLength: -1,
2315
- maxBodyLength: -1,
2316
-
2317
- env: {
2318
- FormData: platform.classes.FormData,
2319
- Blob: platform.classes.Blob,
2320
- },
2321
-
2322
- validateStatus: function validateStatus(status) {
2323
- return status >= 200 && status < 300;
2324
- },
2325
-
2326
- headers: {
2327
- common: {
2328
- Accept: 'application/json, text/plain, */*',
2329
- 'Content-Type': undefined,
2330
- },
2331
- },
2332
- };
2333
-
2334
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
2335
- defaults.headers[method] = {};
2336
- });
2337
-
2338
- /**
2339
- * Transform the data for a request or a response
2340
- *
2341
- * @param {Array|Function} fns A single function or Array of functions
2342
- * @param {?Object} response The response object
2343
- *
2344
- * @returns {*} The resulting transformed data
2345
- */
2346
- function transformData(fns, response) {
2347
- const config = this || defaults;
2348
- const context = response || config;
2349
- const headers = AxiosHeaders.from(context.headers);
2350
- let data = context.data;
2351
-
2352
- utils$1.forEach(fns, function transform(fn) {
2353
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
2354
- });
2355
-
2356
- headers.normalize();
2357
-
2358
- return data;
2359
- }
2360
-
2361
- function isCancel(value) {
2362
- return !!(value && value.__CANCEL__);
2363
- }
2364
-
2365
- class CanceledError extends AxiosError {
2366
- /**
2367
- * A `CanceledError` is an object that is thrown when an operation is canceled.
2368
- *
2369
- * @param {string=} message The message.
2370
- * @param {Object=} config The config.
2371
- * @param {Object=} request The request.
2372
- *
2373
- * @returns {CanceledError} The created error.
2374
- */
2375
- constructor(message, config, request) {
2376
- super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
2377
- this.name = 'CanceledError';
2378
- this.__CANCEL__ = true;
2379
- }
2380
- }
2381
-
2382
- /**
2383
- * Resolve or reject a Promise based on response status.
2384
- *
2385
- * @param {Function} resolve A function that resolves the promise.
2386
- * @param {Function} reject A function that rejects the promise.
2387
- * @param {object} response The response.
2388
- *
2389
- * @returns {object} The response.
2390
- */
2391
- function settle(resolve, reject, response) {
2392
- const validateStatus = response.config.validateStatus;
2393
- if (!response.status || !validateStatus || validateStatus(response.status)) {
2394
- resolve(response);
2395
- } else {
2396
- reject(new AxiosError(
2397
- 'Request failed with status code ' + response.status,
2398
- response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
2399
- response.config,
2400
- response.request,
2401
- response
2402
- ));
2403
- }
2404
- }
2405
-
2406
- function parseProtocol(url) {
2407
- const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2408
- return (match && match[1]) || '';
2409
- }
2410
-
2411
- /**
2412
- * Calculate data maxRate
2413
- * @param {Number} [samplesCount= 10]
2414
- * @param {Number} [min= 1000]
2415
- * @returns {Function}
2416
- */
2417
- function speedometer(samplesCount, min) {
2418
- samplesCount = samplesCount || 10;
2419
- const bytes = new Array(samplesCount);
2420
- const timestamps = new Array(samplesCount);
2421
- let head = 0;
2422
- let tail = 0;
2423
- let firstSampleTS;
2424
-
2425
- min = min !== undefined ? min : 1000;
2426
-
2427
- return function push(chunkLength) {
2428
- const now = Date.now();
2429
-
2430
- const startedAt = timestamps[tail];
2431
-
2432
- if (!firstSampleTS) {
2433
- firstSampleTS = now;
2434
- }
2435
-
2436
- bytes[head] = chunkLength;
2437
- timestamps[head] = now;
2438
-
2439
- let i = tail;
2440
- let bytesCount = 0;
2441
-
2442
- while (i !== head) {
2443
- bytesCount += bytes[i++];
2444
- i = i % samplesCount;
2445
- }
2446
-
2447
- head = (head + 1) % samplesCount;
2448
-
2449
- if (head === tail) {
2450
- tail = (tail + 1) % samplesCount;
2451
- }
2452
-
2453
- if (now - firstSampleTS < min) {
2454
- return;
2455
- }
2456
-
2457
- const passed = startedAt && now - startedAt;
2458
-
2459
- return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
2460
- };
2461
- }
2462
-
2463
- /**
2464
- * Throttle decorator
2465
- * @param {Function} fn
2466
- * @param {Number} freq
2467
- * @return {Function}
2468
- */
2469
- function throttle(fn, freq) {
2470
- let timestamp = 0;
2471
- let threshold = 1000 / freq;
2472
- let lastArgs;
2473
- let timer;
2474
-
2475
- const invoke = (args, now = Date.now()) => {
2476
- timestamp = now;
2477
- lastArgs = null;
2478
- if (timer) {
2479
- clearTimeout(timer);
2480
- timer = null;
2481
- }
2482
- fn(...args);
2483
- };
2484
-
2485
- const throttled = (...args) => {
2486
- const now = Date.now();
2487
- const passed = now - timestamp;
2488
- if (passed >= threshold) {
2489
- invoke(args, now);
2490
- } else {
2491
- lastArgs = args;
2492
- if (!timer) {
2493
- timer = setTimeout(() => {
2494
- timer = null;
2495
- invoke(lastArgs);
2496
- }, threshold - passed);
2497
- }
2498
- }
2499
- };
2500
-
2501
- const flush = () => lastArgs && invoke(lastArgs);
2502
-
2503
- return [throttled, flush];
2504
- }
2505
-
2506
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2507
- let bytesNotified = 0;
2508
- const _speedometer = speedometer(50, 250);
2509
-
2510
- return throttle((e) => {
2511
- const rawLoaded = e.loaded;
2512
- const total = e.lengthComputable ? e.total : undefined;
2513
- const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
2514
- const progressBytes = Math.max(0, loaded - bytesNotified);
2515
- const rate = _speedometer(progressBytes);
2516
-
2517
- bytesNotified = Math.max(bytesNotified, loaded);
2518
-
2519
- const data = {
2520
- loaded,
2521
- total,
2522
- progress: total ? loaded / total : undefined,
2523
- bytes: progressBytes,
2524
- rate: rate ? rate : undefined,
2525
- estimated: rate && total ? (total - loaded) / rate : undefined,
2526
- event: e,
2527
- lengthComputable: total != null,
2528
- [isDownloadStream ? 'download' : 'upload']: true,
2529
- };
2530
-
2531
- listener(data);
2532
- }, freq);
2533
- };
2534
-
2535
- const progressEventDecorator = (total, throttled) => {
2536
- const lengthComputable = total != null;
2537
-
2538
- return [
2539
- (loaded) =>
2540
- throttled[0]({
2541
- lengthComputable,
2542
- total,
2543
- loaded,
2544
- }),
2545
- throttled[1],
2546
- ];
2547
- };
2548
-
2549
- const asyncDecorator =
2550
- (fn) =>
2551
- (...args) =>
2552
- utils$1.asap(() => fn(...args));
2553
-
2554
- var isURLSameOrigin = platform.hasStandardBrowserEnv
2555
- ? ((origin, isMSIE) => (url) => {
2556
- url = new URL(url, platform.origin);
2557
-
2558
- return (
2559
- origin.protocol === url.protocol &&
2560
- origin.host === url.host &&
2561
- (isMSIE || origin.port === url.port)
2562
- );
2563
- })(
2564
- new URL(platform.origin),
2565
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
2566
- )
2567
- : () => true;
2568
-
2569
- var cookies = platform.hasStandardBrowserEnv
2570
- ? // Standard browser envs support document.cookie
2571
- {
2572
- write(name, value, expires, path, domain, secure, sameSite) {
2573
- if (typeof document === 'undefined') return;
2574
-
2575
- const cookie = [`${name}=${encodeURIComponent(value)}`];
2576
-
2577
- if (utils$1.isNumber(expires)) {
2578
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
2579
- }
2580
- if (utils$1.isString(path)) {
2581
- cookie.push(`path=${path}`);
2582
- }
2583
- if (utils$1.isString(domain)) {
2584
- cookie.push(`domain=${domain}`);
2585
- }
2586
- if (secure === true) {
2587
- cookie.push('secure');
2588
- }
2589
- if (utils$1.isString(sameSite)) {
2590
- cookie.push(`SameSite=${sameSite}`);
2591
- }
2592
-
2593
- document.cookie = cookie.join('; ');
2594
- },
2595
-
2596
- read(name) {
2597
- if (typeof document === 'undefined') return null;
2598
- // Match name=value by splitting on the semicolon separator instead of building a
2599
- // RegExp from `name` — interpolating an unescaped string into a RegExp would let
2600
- // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
2601
- // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
2602
- // "; ", so ignore optional whitespace before each cookie name.
2603
- const cookies = document.cookie.split(';');
2604
- for (let i = 0; i < cookies.length; i++) {
2605
- const cookie = cookies[i].replace(/^\s+/, '');
2606
- const eq = cookie.indexOf('=');
2607
- if (eq !== -1 && cookie.slice(0, eq) === name) {
2608
- return decodeURIComponent(cookie.slice(eq + 1));
2609
- }
2610
- }
2611
- return null;
2612
- },
2613
-
2614
- remove(name) {
2615
- this.write(name, '', Date.now() - 86400000, '/');
2616
- },
2617
- }
2618
- : // Non-standard browser env (web workers, react-native) lack needed support.
2619
- {
2620
- write() {},
2621
- read() {
2622
- return null;
2623
- },
2624
- remove() {},
2625
- };
2626
-
2627
- /**
2628
- * Determines whether the specified URL is absolute
2629
- *
2630
- * @param {string} url The URL to test
2631
- *
2632
- * @returns {boolean} True if the specified URL is absolute, otherwise false
2633
- */
2634
- function isAbsoluteURL(url) {
2635
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2636
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2637
- // by any combination of letters, digits, plus, period, or hyphen.
2638
- if (typeof url !== 'string') {
2639
- return false;
2640
- }
2641
-
2642
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2643
- }
2644
-
2645
- /**
2646
- * Creates a new URL by combining the specified URLs
2647
- *
2648
- * @param {string} baseURL The base URL
2649
- * @param {string} relativeURL The relative URL
2650
- *
2651
- * @returns {string} The combined URL
2652
- */
2653
- function combineURLs(baseURL, relativeURL) {
2654
- return relativeURL
2655
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2656
- : baseURL;
2657
- }
2658
-
2659
- /**
2660
- * Creates a new URL by combining the baseURL with the requestedURL,
2661
- * only when the requestedURL is not already an absolute URL.
2662
- * If the requestURL is absolute, this function returns the requestedURL untouched.
2663
- *
2664
- * @param {string} baseURL The base URL
2665
- * @param {string} requestedURL Absolute or relative URL to combine
2666
- *
2667
- * @returns {string} The combined full path
2668
- */
2669
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2670
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
2671
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2672
- return combineURLs(baseURL, requestedURL);
2673
- }
2674
- return requestedURL;
2675
- }
2676
-
2677
- const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing } : thing);
2678
-
2679
- /**
2680
- * Config-specific merge-function which creates a new config-object
2681
- * by merging two configuration objects together.
2682
- *
2683
- * @param {Object} config1
2684
- * @param {Object} config2
2685
- *
2686
- * @returns {Object} New object resulting from merging config2 to config1
2687
- */
2688
- function mergeConfig(config1, config2) {
2689
- // eslint-disable-next-line no-param-reassign
2690
- config2 = config2 || {};
2691
-
2692
- // Use a null-prototype object so that downstream reads such as `config.auth`
2693
- // or `config.baseURL` cannot inherit polluted values from Object.prototype.
2694
- // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
2695
- // ergonomics for user code that relies on it.
2696
- const config = Object.create(null);
2697
- Object.defineProperty(config, 'hasOwnProperty', {
2698
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2699
- // this data descriptor into an accessor descriptor on the way in.
2700
- __proto__: null,
2701
- value: Object.prototype.hasOwnProperty,
2702
- enumerable: false,
2703
- writable: true,
2704
- configurable: true,
2705
- });
2706
-
2707
- function getMergedValue(target, source, prop, caseless) {
2708
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2709
- return utils$1.merge.call({ caseless }, target, source);
2710
- } else if (utils$1.isPlainObject(source)) {
2711
- return utils$1.merge({}, source);
2712
- } else if (utils$1.isArray(source)) {
2713
- return source.slice();
2714
- }
2715
- return source;
2716
- }
2717
-
2718
- function mergeDeepProperties(a, b, prop, caseless) {
2719
- if (!utils$1.isUndefined(b)) {
2720
- return getMergedValue(a, b, prop, caseless);
2721
- } else if (!utils$1.isUndefined(a)) {
2722
- return getMergedValue(undefined, a, prop, caseless);
2723
- }
2724
- }
2725
-
2726
- // eslint-disable-next-line consistent-return
2727
- function valueFromConfig2(a, b) {
2728
- if (!utils$1.isUndefined(b)) {
2729
- return getMergedValue(undefined, b);
2730
- }
2731
- }
2732
-
2733
- // eslint-disable-next-line consistent-return
2734
- function defaultToConfig2(a, b) {
2735
- if (!utils$1.isUndefined(b)) {
2736
- return getMergedValue(undefined, b);
2737
- } else if (!utils$1.isUndefined(a)) {
2738
- return getMergedValue(undefined, a);
2739
- }
2740
- }
2741
-
2742
- // eslint-disable-next-line consistent-return
2743
- function mergeDirectKeys(a, b, prop) {
2744
- if (utils$1.hasOwnProp(config2, prop)) {
2745
- return getMergedValue(a, b);
2746
- } else if (utils$1.hasOwnProp(config1, prop)) {
2747
- return getMergedValue(undefined, a);
2748
- }
2749
- }
2750
-
2751
- const mergeMap = {
2752
- url: valueFromConfig2,
2753
- method: valueFromConfig2,
2754
- data: valueFromConfig2,
2755
- baseURL: defaultToConfig2,
2756
- transformRequest: defaultToConfig2,
2757
- transformResponse: defaultToConfig2,
2758
- paramsSerializer: defaultToConfig2,
2759
- timeout: defaultToConfig2,
2760
- timeoutMessage: defaultToConfig2,
2761
- withCredentials: defaultToConfig2,
2762
- withXSRFToken: defaultToConfig2,
2763
- adapter: defaultToConfig2,
2764
- responseType: defaultToConfig2,
2765
- xsrfCookieName: defaultToConfig2,
2766
- xsrfHeaderName: defaultToConfig2,
2767
- onUploadProgress: defaultToConfig2,
2768
- onDownloadProgress: defaultToConfig2,
2769
- decompress: defaultToConfig2,
2770
- maxContentLength: defaultToConfig2,
2771
- maxBodyLength: defaultToConfig2,
2772
- beforeRedirect: defaultToConfig2,
2773
- transport: defaultToConfig2,
2774
- httpAgent: defaultToConfig2,
2775
- httpsAgent: defaultToConfig2,
2776
- cancelToken: defaultToConfig2,
2777
- socketPath: defaultToConfig2,
2778
- allowedSocketPaths: defaultToConfig2,
2779
- responseEncoding: defaultToConfig2,
2780
- validateStatus: mergeDirectKeys,
2781
- headers: (a, b, prop) =>
2782
- mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
2783
- };
2784
-
2785
- utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2786
- if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
2787
- const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2788
- const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
2789
- const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
2790
- const configValue = merge(a, b, prop);
2791
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2792
- });
2793
-
2794
- return config;
2795
- }
2796
-
2797
- const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
2798
-
2799
- function setFormDataHeaders(headers, formHeaders, policy) {
2800
- if (policy !== 'content-only') {
2801
- headers.set(formHeaders);
2802
- return;
2803
- }
2804
-
2805
- Object.entries(formHeaders).forEach(([key, val]) => {
2806
- if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2807
- headers.set(key, val);
2808
- }
2809
- });
2810
- }
2811
-
2812
- /**
2813
- * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
2814
- * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
2815
- *
2816
- * @param {string} str The string to encode
2817
- *
2818
- * @returns {string} UTF-8 bytes as a Latin-1 string
2819
- */
2820
- const encodeUTF8 = (str) =>
2821
- encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
2822
- String.fromCharCode(parseInt(hex, 16))
2823
- );
2824
-
2825
- var resolveConfig = (config) => {
2826
- const newConfig = mergeConfig({}, config);
2827
-
2828
- // Read only own properties to prevent prototype pollution gadgets
2829
- // (e.g. Object.prototype.baseURL = 'https://evil.com').
2830
- const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
2831
-
2832
- const data = own('data');
2833
- let withXSRFToken = own('withXSRFToken');
2834
- const xsrfHeaderName = own('xsrfHeaderName');
2835
- const xsrfCookieName = own('xsrfCookieName');
2836
- let headers = own('headers');
2837
- const auth = own('auth');
2838
- const baseURL = own('baseURL');
2839
- const allowAbsoluteUrls = own('allowAbsoluteUrls');
2840
- const url = own('url');
2841
-
2842
- newConfig.headers = headers = AxiosHeaders.from(headers);
2843
-
2844
- newConfig.url = buildURL(
2845
- buildFullPath(baseURL, url, allowAbsoluteUrls),
2846
- config.params,
2847
- config.paramsSerializer
2848
- );
2849
-
2850
- // HTTP basic authentication
2851
- if (auth) {
2852
- headers.set(
2853
- 'Authorization',
2854
- 'Basic ' +
2855
- btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
2856
- );
2857
- }
2858
-
2859
- if (utils$1.isFormData(data)) {
2860
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2861
- headers.setContentType(undefined); // browser handles it
2862
- } else if (utils$1.isFunction(data.getHeaders)) {
2863
- // Node.js FormData (like form-data package)
2864
- setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
2865
- }
2866
- }
2867
-
2868
- // Add xsrf header
2869
- // This is only done if running in a standard browser environment.
2870
- // Specifically not if we're in a web worker, or react-native.
2871
-
2872
- if (platform.hasStandardBrowserEnv) {
2873
- if (utils$1.isFunction(withXSRFToken)) {
2874
- withXSRFToken = withXSRFToken(newConfig);
2875
- }
2876
-
2877
- // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
2878
- // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
2879
- // the XSRF token cross-origin.
2880
- const shouldSendXSRF =
2881
- withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
2882
-
2883
- if (shouldSendXSRF) {
2884
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2885
-
2886
- if (xsrfValue) {
2887
- headers.set(xsrfHeaderName, xsrfValue);
2888
- }
2889
- }
2890
- }
2891
-
2892
- return newConfig;
2893
- };
2894
-
2895
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2896
-
2897
- var xhrAdapter = isXHRAdapterSupported &&
2898
- function (config) {
2899
- return new Promise(function dispatchXhrRequest(resolve, reject) {
2900
- const _config = resolveConfig(config);
2901
- let requestData = _config.data;
2902
- const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
2903
- let { responseType, onUploadProgress, onDownloadProgress } = _config;
2904
- let onCanceled;
2905
- let uploadThrottled, downloadThrottled;
2906
- let flushUpload, flushDownload;
2907
-
2908
- function done() {
2909
- flushUpload && flushUpload(); // flush events
2910
- flushDownload && flushDownload(); // flush events
2911
-
2912
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2913
-
2914
- _config.signal && _config.signal.removeEventListener('abort', onCanceled);
2915
- }
2916
-
2917
- let request = new XMLHttpRequest();
2918
-
2919
- request.open(_config.method.toUpperCase(), _config.url, true);
2920
-
2921
- // Set the request timeout in MS
2922
- request.timeout = _config.timeout;
2923
-
2924
- function onloadend() {
2925
- if (!request) {
2926
- return;
2927
- }
2928
- // Prepare the response
2929
- const responseHeaders = AxiosHeaders.from(
2930
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2931
- );
2932
- const responseData =
2933
- !responseType || responseType === 'text' || responseType === 'json'
2934
- ? request.responseText
2935
- : request.response;
2936
- const response = {
2937
- data: responseData,
2938
- status: request.status,
2939
- statusText: request.statusText,
2940
- headers: responseHeaders,
2941
- config,
2942
- request,
2943
- };
2944
-
2945
- settle(
2946
- function _resolve(value) {
2947
- resolve(value);
2948
- done();
2949
- },
2950
- function _reject(err) {
2951
- reject(err);
2952
- done();
2953
- },
2954
- response
2955
- );
2956
-
2957
- // Clean up request
2958
- request = null;
2959
- }
2960
-
2961
- if ('onloadend' in request) {
2962
- // Use onloadend if available
2963
- request.onloadend = onloadend;
2964
- } else {
2965
- // Listen for ready state to emulate onloadend
2966
- request.onreadystatechange = function handleLoad() {
2967
- if (!request || request.readyState !== 4) {
2968
- return;
2969
- }
2970
-
2971
- // The request errored out and we didn't get a response, this will be
2972
- // handled by onerror instead
2973
- // With one exception: request that using file: protocol, most browsers
2974
- // will return status as 0 even though it's a successful request
2975
- if (
2976
- request.status === 0 &&
2977
- !(request.responseURL && request.responseURL.startsWith('file:'))
2978
- ) {
2979
- return;
2980
- }
2981
- // readystate handler is calling before onerror or ontimeout handlers,
2982
- // so we should call onloadend on the next 'tick'
2983
- setTimeout(onloadend);
2984
- };
2985
- }
2986
-
2987
- // Handle browser request cancellation (as opposed to a manual cancellation)
2988
- request.onabort = function handleAbort() {
2989
- if (!request) {
2990
- return;
2991
- }
2992
-
2993
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2994
- done();
2995
-
2996
- // Clean up request
2997
- request = null;
2998
- };
2999
-
3000
- // Handle low level network errors
3001
- request.onerror = function handleError(event) {
3002
- // Browsers deliver a ProgressEvent in XHR onerror
3003
- // (message may be empty; when present, surface it)
3004
- // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
3005
- const msg = event && event.message ? event.message : 'Network Error';
3006
- const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
3007
- // attach the underlying event for consumers who want details
3008
- err.event = event || null;
3009
- reject(err);
3010
- done();
3011
- request = null;
3012
- };
3013
-
3014
- // Handle timeout
3015
- request.ontimeout = function handleTimeout() {
3016
- let timeoutErrorMessage = _config.timeout
3017
- ? 'timeout of ' + _config.timeout + 'ms exceeded'
3018
- : 'timeout exceeded';
3019
- const transitional = _config.transitional || transitionalDefaults;
3020
- if (_config.timeoutErrorMessage) {
3021
- timeoutErrorMessage = _config.timeoutErrorMessage;
3022
- }
3023
- reject(
3024
- new AxiosError(
3025
- timeoutErrorMessage,
3026
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
3027
- config,
3028
- request
3029
- )
3030
- );
3031
- done();
3032
-
3033
- // Clean up request
3034
- request = null;
3035
- };
3036
-
3037
- // Remove Content-Type if data is undefined
3038
- requestData === undefined && requestHeaders.setContentType(null);
3039
-
3040
- // Add headers to the request
3041
- if ('setRequestHeader' in request) {
3042
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3043
- request.setRequestHeader(key, val);
3044
- });
3045
- }
3046
-
3047
- // Add withCredentials to request if needed
3048
- if (!utils$1.isUndefined(_config.withCredentials)) {
3049
- request.withCredentials = !!_config.withCredentials;
3050
- }
3051
-
3052
- // Add responseType to request if needed
3053
- if (responseType && responseType !== 'json') {
3054
- request.responseType = _config.responseType;
3055
- }
3056
-
3057
- // Handle progress if needed
3058
- if (onDownloadProgress) {
3059
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
3060
- request.addEventListener('progress', downloadThrottled);
3061
- }
3062
-
3063
- // Not all browsers support upload events
3064
- if (onUploadProgress && request.upload) {
3065
- [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
3066
-
3067
- request.upload.addEventListener('progress', uploadThrottled);
3068
-
3069
- request.upload.addEventListener('loadend', flushUpload);
3070
- }
3071
-
3072
- if (_config.cancelToken || _config.signal) {
3073
- // Handle cancellation
3074
- // eslint-disable-next-line func-names
3075
- onCanceled = (cancel) => {
3076
- if (!request) {
3077
- return;
3078
- }
3079
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3080
- request.abort();
3081
- done();
3082
- request = null;
3083
- };
3084
-
3085
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3086
- if (_config.signal) {
3087
- _config.signal.aborted
3088
- ? onCanceled()
3089
- : _config.signal.addEventListener('abort', onCanceled);
3090
- }
3091
- }
3092
-
3093
- const protocol = parseProtocol(_config.url);
3094
-
3095
- if (protocol && !platform.protocols.includes(protocol)) {
3096
- reject(
3097
- new AxiosError(
3098
- 'Unsupported protocol ' + protocol + ':',
3099
- AxiosError.ERR_BAD_REQUEST,
3100
- config
3101
- )
3102
- );
3103
- return;
3104
- }
3105
-
3106
- // Send the request
3107
- request.send(requestData || null);
3108
- });
3109
- };
3110
-
3111
- const composeSignals = (signals, timeout) => {
3112
- const { length } = (signals = signals ? signals.filter(Boolean) : []);
3113
-
3114
- if (timeout || length) {
3115
- let controller = new AbortController();
3116
-
3117
- let aborted;
3118
-
3119
- const onabort = function (reason) {
3120
- if (!aborted) {
3121
- aborted = true;
3122
- unsubscribe();
3123
- const err = reason instanceof Error ? reason : this.reason;
3124
- controller.abort(
3125
- err instanceof AxiosError
3126
- ? err
3127
- : new CanceledError(err instanceof Error ? err.message : err)
3128
- );
3129
- }
3130
- };
3131
-
3132
- let timer =
3133
- timeout &&
3134
- setTimeout(() => {
3135
- timer = null;
3136
- onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
3137
- }, timeout);
3138
-
3139
- const unsubscribe = () => {
3140
- if (signals) {
3141
- timer && clearTimeout(timer);
3142
- timer = null;
3143
- signals.forEach((signal) => {
3144
- signal.unsubscribe
3145
- ? signal.unsubscribe(onabort)
3146
- : signal.removeEventListener('abort', onabort);
3147
- });
3148
- signals = null;
3149
- }
3150
- };
3151
-
3152
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
3153
-
3154
- const { signal } = controller;
3155
-
3156
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
3157
-
3158
- return signal;
3159
- }
3160
- };
3161
-
3162
- const streamChunk = function* (chunk, chunkSize) {
3163
- let len = chunk.byteLength;
3164
-
3165
- if (len < chunkSize) {
3166
- yield chunk;
3167
- return;
3168
- }
3169
-
3170
- let pos = 0;
3171
- let end;
3172
-
3173
- while (pos < len) {
3174
- end = pos + chunkSize;
3175
- yield chunk.slice(pos, end);
3176
- pos = end;
3177
- }
3178
- };
3179
-
3180
- const readBytes = async function* (iterable, chunkSize) {
3181
- for await (const chunk of readStream(iterable)) {
3182
- yield* streamChunk(chunk, chunkSize);
3183
- }
3184
- };
3185
-
3186
- const readStream = async function* (stream) {
3187
- if (stream[Symbol.asyncIterator]) {
3188
- yield* stream;
3189
- return;
3190
- }
3191
-
3192
- const reader = stream.getReader();
3193
- try {
3194
- for (;;) {
3195
- const { done, value } = await reader.read();
3196
- if (done) {
3197
- break;
3198
- }
3199
- yield value;
3200
- }
3201
- } finally {
3202
- await reader.cancel();
3203
- }
3204
- };
3205
-
3206
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3207
- const iterator = readBytes(stream, chunkSize);
3208
-
3209
- let bytes = 0;
3210
- let done;
3211
- let _onFinish = (e) => {
3212
- if (!done) {
3213
- done = true;
3214
- onFinish && onFinish(e);
3215
- }
3216
- };
3217
-
3218
- return new ReadableStream(
3219
- {
3220
- async pull(controller) {
3221
- try {
3222
- const { done, value } = await iterator.next();
3223
-
3224
- if (done) {
3225
- _onFinish();
3226
- controller.close();
3227
- return;
3228
- }
3229
-
3230
- let len = value.byteLength;
3231
- if (onProgress) {
3232
- let loadedBytes = (bytes += len);
3233
- onProgress(loadedBytes);
3234
- }
3235
- controller.enqueue(new Uint8Array(value));
3236
- } catch (err) {
3237
- _onFinish(err);
3238
- throw err;
3239
- }
3240
- },
3241
- cancel(reason) {
3242
- _onFinish(reason);
3243
- return iterator.return();
3244
- },
3245
- },
3246
- {
3247
- highWaterMark: 2,
3248
- }
3249
- );
3250
- };
3251
-
3252
- /**
3253
- * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3254
- * - For base64: compute exact decoded size using length and padding;
3255
- * handle %XX at the character-count level (no string allocation).
3256
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3257
- *
3258
- * @param {string} url
3259
- * @returns {number}
3260
- */
3261
- function estimateDataURLDecodedBytes(url) {
3262
- if (!url || typeof url !== 'string') return 0;
3263
- if (!url.startsWith('data:')) return 0;
3264
-
3265
- const comma = url.indexOf(',');
3266
- if (comma < 0) return 0;
3267
-
3268
- const meta = url.slice(5, comma);
3269
- const body = url.slice(comma + 1);
3270
- const isBase64 = /;base64/i.test(meta);
3271
-
3272
- if (isBase64) {
3273
- let effectiveLen = body.length;
3274
- const len = body.length; // cache length
3275
-
3276
- for (let i = 0; i < len; i++) {
3277
- if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3278
- const a = body.charCodeAt(i + 1);
3279
- const b = body.charCodeAt(i + 2);
3280
- const isHex =
3281
- ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
3282
- ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
3283
-
3284
- if (isHex) {
3285
- effectiveLen -= 2;
3286
- i += 2;
3287
- }
3288
- }
3289
- }
3290
-
3291
- let pad = 0;
3292
- let idx = len - 1;
3293
-
3294
- const tailIsPct3D = (j) =>
3295
- j >= 2 &&
3296
- body.charCodeAt(j - 2) === 37 && // '%'
3297
- body.charCodeAt(j - 1) === 51 && // '3'
3298
- (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
3299
-
3300
- if (idx >= 0) {
3301
- if (body.charCodeAt(idx) === 61 /* '=' */) {
3302
- pad++;
3303
- idx--;
3304
- } else if (tailIsPct3D(idx)) {
3305
- pad++;
3306
- idx -= 3;
3307
- }
3308
- }
3309
-
3310
- if (pad === 1 && idx >= 0) {
3311
- if (body.charCodeAt(idx) === 61 /* '=' */) {
3312
- pad++;
3313
- } else if (tailIsPct3D(idx)) {
3314
- pad++;
3315
- }
3316
- }
3317
-
3318
- const groups = Math.floor(effectiveLen / 4);
3319
- const bytes = groups * 3 - (pad || 0);
3320
- return bytes > 0 ? bytes : 0;
3321
- }
3322
-
3323
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3324
- return Buffer.byteLength(body, 'utf8');
3325
- }
3326
-
3327
- // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3328
- // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3329
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3330
- // but 3 UTF-8 bytes).
3331
- let bytes = 0;
3332
- for (let i = 0, len = body.length; i < len; i++) {
3333
- const c = body.charCodeAt(i);
3334
- if (c < 0x80) {
3335
- bytes += 1;
3336
- } else if (c < 0x800) {
3337
- bytes += 2;
3338
- } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
3339
- const next = body.charCodeAt(i + 1);
3340
- if (next >= 0xdc00 && next <= 0xdfff) {
3341
- bytes += 4;
3342
- i++;
3343
- } else {
3344
- bytes += 3;
3345
- }
3346
- } else {
3347
- bytes += 3;
3348
- }
3349
- }
3350
- return bytes;
3351
- }
3352
-
3353
- const VERSION = "1.16.0";
3354
-
3355
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
3356
-
3357
- const { isFunction } = utils$1;
3358
-
3359
- const test = (fn, ...args) => {
3360
- try {
3361
- return !!fn(...args);
3362
- } catch (e) {
3363
- return false;
3364
- }
3365
- };
3366
-
3367
- const factory = (env) => {
3368
- const globalObject = utils$1.global ?? globalThis;
3369
- const { ReadableStream, TextEncoder } = globalObject;
3370
-
3371
- env = utils$1.merge.call(
3372
- {
3373
- skipUndefined: true,
3374
- },
3375
- {
3376
- Request: globalObject.Request,
3377
- Response: globalObject.Response,
3378
- },
3379
- env
3380
- );
3381
-
3382
- const { fetch: envFetch, Request, Response } = env;
3383
- const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
3384
- const isRequestSupported = isFunction(Request);
3385
- const isResponseSupported = isFunction(Response);
3386
-
3387
- if (!isFetchSupported) {
3388
- return false;
3389
- }
3390
-
3391
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
3392
-
3393
- const encodeText =
3394
- isFetchSupported &&
3395
- (typeof TextEncoder === 'function'
3396
- ? (
3397
- (encoder) => (str) =>
3398
- encoder.encode(str)
3399
- )(new TextEncoder())
3400
- : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
3401
-
3402
- const supportsRequestStream =
3403
- isRequestSupported &&
3404
- isReadableStreamSupported &&
3405
- test(() => {
3406
- let duplexAccessed = false;
3407
-
3408
- const request = new Request(platform.origin, {
3409
- body: new ReadableStream(),
3410
- method: 'POST',
3411
- get duplex() {
3412
- duplexAccessed = true;
3413
- return 'half';
3414
- },
3415
- });
3416
-
3417
- const hasContentType = request.headers.has('Content-Type');
3418
-
3419
- if (request.body != null) {
3420
- request.body.cancel();
3421
- }
3422
-
3423
- return duplexAccessed && !hasContentType;
3424
- });
3425
-
3426
- const supportsResponseStream =
3427
- isResponseSupported &&
3428
- isReadableStreamSupported &&
3429
- test(() => utils$1.isReadableStream(new Response('').body));
3430
-
3431
- const resolvers = {
3432
- stream: supportsResponseStream && ((res) => res.body),
3433
- };
3434
-
3435
- isFetchSupported &&
3436
- (() => {
3437
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
3438
- !resolvers[type] &&
3439
- (resolvers[type] = (res, config) => {
3440
- let method = res && res[type];
3441
-
3442
- if (method) {
3443
- return method.call(res);
3444
- }
3445
-
3446
- throw new AxiosError(
3447
- `Response type '${type}' is not supported`,
3448
- AxiosError.ERR_NOT_SUPPORT,
3449
- config
3450
- );
3451
- });
3452
- });
3453
- })();
3454
-
3455
- const getBodyLength = async (body) => {
3456
- if (body == null) {
3457
- return 0;
3458
- }
3459
-
3460
- if (utils$1.isBlob(body)) {
3461
- return body.size;
3462
- }
3463
-
3464
- if (utils$1.isSpecCompliantForm(body)) {
3465
- const _request = new Request(platform.origin, {
3466
- method: 'POST',
3467
- body,
3468
- });
3469
- return (await _request.arrayBuffer()).byteLength;
3470
- }
3471
-
3472
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3473
- return body.byteLength;
3474
- }
3475
-
3476
- if (utils$1.isURLSearchParams(body)) {
3477
- body = body + '';
3478
- }
3479
-
3480
- if (utils$1.isString(body)) {
3481
- return (await encodeText(body)).byteLength;
3482
- }
3483
- };
3484
-
3485
- const resolveBodyLength = async (headers, body) => {
3486
- const length = utils$1.toFiniteNumber(headers.getContentLength());
3487
-
3488
- return length == null ? getBodyLength(body) : length;
3489
- };
3490
-
3491
- return async (config) => {
3492
- let {
3493
- url,
3494
- method,
3495
- data,
3496
- signal,
3497
- cancelToken,
3498
- timeout,
3499
- onDownloadProgress,
3500
- onUploadProgress,
3501
- responseType,
3502
- headers,
3503
- withCredentials = 'same-origin',
3504
- fetchOptions,
3505
- maxContentLength,
3506
- maxBodyLength,
3507
- } = resolveConfig(config);
3508
-
3509
- const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
3510
- const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
3511
-
3512
- let _fetch = envFetch || fetch;
3513
-
3514
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3515
-
3516
- let composedSignal = composeSignals(
3517
- [signal, cancelToken && cancelToken.toAbortSignal()],
3518
- timeout
3519
- );
3520
-
3521
- let request = null;
3522
-
3523
- const unsubscribe =
3524
- composedSignal &&
3525
- composedSignal.unsubscribe &&
3526
- (() => {
3527
- composedSignal.unsubscribe();
3528
- });
3529
-
3530
- let requestContentLength;
3531
-
3532
- try {
3533
- // Enforce maxContentLength for data: URLs up-front so we never materialize
3534
- // an oversized payload. The HTTP adapter applies the same check (see http.js
3535
- // "if (protocol === 'data:')" branch).
3536
- if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
3537
- const estimated = estimateDataURLDecodedBytes(url);
3538
- if (estimated > maxContentLength) {
3539
- throw new AxiosError(
3540
- 'maxContentLength size of ' + maxContentLength + ' exceeded',
3541
- AxiosError.ERR_BAD_RESPONSE,
3542
- config,
3543
- request
3544
- );
3545
- }
3546
- }
3547
-
3548
- // Enforce maxBodyLength against the outbound request body before dispatch.
3549
- // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
3550
- // maxBodyLength limit'). Skip when the body length cannot be determined
3551
- // (e.g. a live ReadableStream supplied by the caller).
3552
- if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
3553
- const outboundLength = await resolveBodyLength(headers, data);
3554
- if (
3555
- typeof outboundLength === 'number' &&
3556
- isFinite(outboundLength) &&
3557
- outboundLength > maxBodyLength
3558
- ) {
3559
- throw new AxiosError(
3560
- 'Request body larger than maxBodyLength limit',
3561
- AxiosError.ERR_BAD_REQUEST,
3562
- config,
3563
- request
3564
- );
3565
- }
3566
- }
3567
-
3568
- if (
3569
- onUploadProgress &&
3570
- supportsRequestStream &&
3571
- method !== 'get' &&
3572
- method !== 'head' &&
3573
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3574
- ) {
3575
- let _request = new Request(url, {
3576
- method: 'POST',
3577
- body: data,
3578
- duplex: 'half',
3579
- });
3580
-
3581
- let contentTypeHeader;
3582
-
3583
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3584
- headers.setContentType(contentTypeHeader);
3585
- }
3586
-
3587
- if (_request.body) {
3588
- const [onProgress, flush] = progressEventDecorator(
3589
- requestContentLength,
3590
- progressEventReducer(asyncDecorator(onUploadProgress))
3591
- );
3592
-
3593
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3594
- }
3595
- }
3596
-
3597
- if (!utils$1.isString(withCredentials)) {
3598
- withCredentials = withCredentials ? 'include' : 'omit';
3599
- }
3600
-
3601
- // Cloudflare Workers throws when credentials are defined
3602
- // see https://github.com/cloudflare/workerd/issues/902
3603
- const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
3604
-
3605
- // If data is FormData and Content-Type is multipart/form-data without boundary,
3606
- // delete it so fetch can set it correctly with the boundary
3607
- if (utils$1.isFormData(data)) {
3608
- const contentType = headers.getContentType();
3609
- if (
3610
- contentType &&
3611
- /^multipart\/form-data/i.test(contentType) &&
3612
- !/boundary=/i.test(contentType)
3613
- ) {
3614
- headers.delete('content-type');
3615
- }
3616
- }
3617
-
3618
- // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
3619
- headers.set('User-Agent', 'axios/' + VERSION, false);
3620
-
3621
- const resolvedOptions = {
3622
- ...fetchOptions,
3623
- signal: composedSignal,
3624
- method: method.toUpperCase(),
3625
- headers: headers.normalize().toJSON(),
3626
- body: data,
3627
- duplex: 'half',
3628
- credentials: isCredentialsSupported ? withCredentials : undefined,
3629
- };
3630
-
3631
- request = isRequestSupported && new Request(url, resolvedOptions);
3632
-
3633
- let response = await (isRequestSupported
3634
- ? _fetch(request, fetchOptions)
3635
- : _fetch(url, resolvedOptions));
3636
-
3637
- // Cheap pre-check: if the server honestly declares a content-length that
3638
- // already exceeds the cap, reject before we start streaming.
3639
- if (hasMaxContentLength) {
3640
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3641
- if (declaredLength != null && declaredLength > maxContentLength) {
3642
- throw new AxiosError(
3643
- 'maxContentLength size of ' + maxContentLength + ' exceeded',
3644
- AxiosError.ERR_BAD_RESPONSE,
3645
- config,
3646
- request
3647
- );
3648
- }
3649
- }
3650
-
3651
- const isStreamResponse =
3652
- supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3653
-
3654
- if (
3655
- supportsResponseStream &&
3656
- response.body &&
3657
- (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
3658
- ) {
3659
- const options = {};
3660
-
3661
- ['status', 'statusText', 'headers'].forEach((prop) => {
3662
- options[prop] = response[prop];
3663
- });
3664
-
3665
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3666
-
3667
- const [onProgress, flush] =
3668
- (onDownloadProgress &&
3669
- progressEventDecorator(
3670
- responseContentLength,
3671
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
3672
- )) ||
3673
- [];
3674
-
3675
- let bytesRead = 0;
3676
- const onChunkProgress = (loadedBytes) => {
3677
- if (hasMaxContentLength) {
3678
- bytesRead = loadedBytes;
3679
- if (bytesRead > maxContentLength) {
3680
- throw new AxiosError(
3681
- 'maxContentLength size of ' + maxContentLength + ' exceeded',
3682
- AxiosError.ERR_BAD_RESPONSE,
3683
- config,
3684
- request
3685
- );
3686
- }
3687
- }
3688
- onProgress && onProgress(loadedBytes);
3689
- };
3690
-
3691
- response = new Response(
3692
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
3693
- flush && flush();
3694
- unsubscribe && unsubscribe();
3695
- }),
3696
- options
3697
- );
3698
- }
3699
-
3700
- responseType = responseType || 'text';
3701
-
3702
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
3703
- response,
3704
- config
3705
- );
3706
-
3707
- // Fallback enforcement for environments without ReadableStream support
3708
- // (legacy runtimes). Detect materialized size from typed output; skip
3709
- // streams/Response passthrough since the user will read those themselves.
3710
- if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
3711
- let materializedSize;
3712
- if (responseData != null) {
3713
- if (typeof responseData.byteLength === 'number') {
3714
- materializedSize = responseData.byteLength;
3715
- } else if (typeof responseData.size === 'number') {
3716
- materializedSize = responseData.size;
3717
- } else if (typeof responseData === 'string') {
3718
- materializedSize =
3719
- typeof TextEncoder === 'function'
3720
- ? new TextEncoder().encode(responseData).byteLength
3721
- : responseData.length;
3722
- }
3723
- }
3724
- if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
3725
- throw new AxiosError(
3726
- 'maxContentLength size of ' + maxContentLength + ' exceeded',
3727
- AxiosError.ERR_BAD_RESPONSE,
3728
- config,
3729
- request
3730
- );
3731
- }
3732
- }
3733
-
3734
- !isStreamResponse && unsubscribe && unsubscribe();
3735
-
3736
- return await new Promise((resolve, reject) => {
3737
- settle(resolve, reject, {
3738
- data: responseData,
3739
- headers: AxiosHeaders.from(response.headers),
3740
- status: response.status,
3741
- statusText: response.statusText,
3742
- config,
3743
- request,
3744
- });
3745
- });
3746
- } catch (err) {
3747
- unsubscribe && unsubscribe();
3748
-
3749
- // Safari can surface fetch aborts as a DOMException-like object whose
3750
- // branded getters throw. Prefer our composed signal reason before reading
3751
- // the caught error, preserving timeout vs cancellation semantics.
3752
- if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
3753
- const canceledError = composedSignal.reason;
3754
- canceledError.config = config;
3755
- request && (canceledError.request = request);
3756
- err !== canceledError && (canceledError.cause = err);
3757
- throw canceledError;
3758
- }
3759
-
3760
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3761
- throw Object.assign(
3762
- new AxiosError(
3763
- 'Network Error',
3764
- AxiosError.ERR_NETWORK,
3765
- config,
3766
- request,
3767
- err && err.response
3768
- ),
3769
- {
3770
- cause: err.cause || err,
3771
- }
3772
- );
3773
- }
3774
-
3775
- throw AxiosError.from(err, err && err.code, config, request, err && err.response);
3776
- }
3777
- };
3778
- };
3779
-
3780
- const seedCache = new Map();
3781
-
3782
- const getFetch = (config) => {
3783
- let env = (config && config.env) || {};
3784
- const { fetch, Request, Response } = env;
3785
- const seeds = [Request, Response, fetch];
3786
-
3787
- let len = seeds.length,
3788
- i = len,
3789
- seed,
3790
- target,
3791
- map = seedCache;
3792
-
3793
- while (i--) {
3794
- seed = seeds[i];
3795
- target = map.get(seed);
3796
-
3797
- target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
3798
-
3799
- map = target;
3800
- }
3801
-
3802
- return target;
3803
- };
3804
-
3805
- getFetch();
3806
-
3807
- /**
3808
- * Known adapters mapping.
3809
- * Provides environment-specific adapters for Axios:
3810
- * - `http` for Node.js
3811
- * - `xhr` for browsers
3812
- * - `fetch` for fetch API-based requests
3813
- *
3814
- * @type {Object<string, Function|Object>}
3815
- */
3816
- const knownAdapters = {
3817
- http: httpAdapter,
3818
- xhr: xhrAdapter,
3819
- fetch: {
3820
- get: getFetch,
3821
- },
3822
- };
3823
-
3824
- // Assign adapter names for easier debugging and identification
3825
- utils$1.forEach(knownAdapters, (fn, value) => {
3826
- if (fn) {
3827
- try {
3828
- // Null-proto descriptors so a polluted Object.prototype.get cannot turn
3829
- // these data descriptors into accessor descriptors on the way in.
3830
- Object.defineProperty(fn, 'name', { __proto__: null, value });
3831
- } catch (e) {
3832
- // eslint-disable-next-line no-empty
3833
- }
3834
- Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
3835
- }
3836
- });
3837
-
3838
- /**
3839
- * Render a rejection reason string for unknown or unsupported adapters
3840
- *
3841
- * @param {string} reason
3842
- * @returns {string}
3843
- */
3844
- const renderReason = (reason) => `- ${reason}`;
3845
-
3846
- /**
3847
- * Check if the adapter is resolved (function, null, or false)
3848
- *
3849
- * @param {Function|null|false} adapter
3850
- * @returns {boolean}
3851
- */
3852
- const isResolvedHandle = (adapter) =>
3853
- utils$1.isFunction(adapter) || adapter === null || adapter === false;
3854
-
3855
- /**
3856
- * Get the first suitable adapter from the provided list.
3857
- * Tries each adapter in order until a supported one is found.
3858
- * Throws an AxiosError if no adapter is suitable.
3859
- *
3860
- * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
3861
- * @param {Object} config - Axios request configuration
3862
- * @throws {AxiosError} If no suitable adapter is available
3863
- * @returns {Function} The resolved adapter function
3864
- */
3865
- function getAdapter(adapters, config) {
3866
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3867
-
3868
- const { length } = adapters;
3869
- let nameOrAdapter;
3870
- let adapter;
3871
-
3872
- const rejectedReasons = {};
3873
-
3874
- for (let i = 0; i < length; i++) {
3875
- nameOrAdapter = adapters[i];
3876
- let id;
3877
-
3878
- adapter = nameOrAdapter;
3879
-
3880
- if (!isResolvedHandle(nameOrAdapter)) {
3881
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3882
-
3883
- if (adapter === undefined) {
3884
- throw new AxiosError(`Unknown adapter '${id}'`);
3885
- }
3886
- }
3887
-
3888
- if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
3889
- break;
3890
- }
3891
-
3892
- rejectedReasons[id || '#' + i] = adapter;
3893
- }
3894
-
3895
- if (!adapter) {
3896
- const reasons = Object.entries(rejectedReasons).map(
3897
- ([id, state]) =>
3898
- `adapter ${id} ` +
3899
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
3900
- );
3901
-
3902
- let s = length
3903
- ? reasons.length > 1
3904
- ? 'since :\n' + reasons.map(renderReason).join('\n')
3905
- : ' ' + renderReason(reasons[0])
3906
- : 'as no adapter specified';
3907
-
3908
- throw new AxiosError(
3909
- `There is no suitable adapter to dispatch the request ` + s,
3910
- 'ERR_NOT_SUPPORT'
3911
- );
3912
- }
3913
-
3914
- return adapter;
3915
- }
3916
-
3917
- /**
3918
- * Exports Axios adapters and utility to resolve an adapter
3919
- */
3920
- var adapters = {
3921
- /**
3922
- * Resolve an adapter from a list of adapter names or functions.
3923
- * @type {Function}
3924
- */
3925
- getAdapter,
3926
-
3927
- /**
3928
- * Exposes all known adapters
3929
- * @type {Object<string, Function|Object>}
3930
- */
3931
- adapters: knownAdapters,
3932
- };
3933
-
3934
- /**
3935
- * Throws a `CanceledError` if cancellation has been requested.
3936
- *
3937
- * @param {Object} config The config that is to be used for the request
3938
- *
3939
- * @returns {void}
3940
- */
3941
- function throwIfCancellationRequested(config) {
3942
- if (config.cancelToken) {
3943
- config.cancelToken.throwIfRequested();
3944
- }
3945
-
3946
- if (config.signal && config.signal.aborted) {
3947
- throw new CanceledError(null, config);
3948
- }
3949
- }
3950
-
3951
- /**
3952
- * Dispatch a request to the server using the configured adapter.
3953
- *
3954
- * @param {object} config The config that is to be used for the request
3955
- *
3956
- * @returns {Promise} The Promise to be fulfilled
3957
- */
3958
- function dispatchRequest(config) {
3959
- throwIfCancellationRequested(config);
3960
-
3961
- config.headers = AxiosHeaders.from(config.headers);
3962
-
3963
- // Transform request data
3964
- config.data = transformData.call(config, config.transformRequest);
3965
-
3966
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3967
- config.headers.setContentType('application/x-www-form-urlencoded', false);
3968
- }
3969
-
3970
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
3971
-
3972
- return adapter(config).then(
3973
- function onAdapterResolution(response) {
3974
- throwIfCancellationRequested(config);
3975
-
3976
- // Expose the current response on config so that transformResponse can
3977
- // attach it to any AxiosError it throws (e.g. on JSON parse failure).
3978
- // We clean it up afterwards to avoid polluting the config object.
3979
- config.response = response;
3980
- try {
3981
- response.data = transformData.call(config, config.transformResponse, response);
3982
- } finally {
3983
- delete config.response;
3984
- }
3985
-
3986
- response.headers = AxiosHeaders.from(response.headers);
3987
-
3988
- return response;
3989
- },
3990
- function onAdapterRejection(reason) {
3991
- if (!isCancel(reason)) {
3992
- throwIfCancellationRequested(config);
3993
-
3994
- // Transform response data
3995
- if (reason && reason.response) {
3996
- config.response = reason.response;
3997
- try {
3998
- reason.response.data = transformData.call(
3999
- config,
4000
- config.transformResponse,
4001
- reason.response
4002
- );
4003
- } finally {
4004
- delete config.response;
4005
- }
4006
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
4007
- }
4008
- }
4009
-
4010
- return Promise.reject(reason);
4011
- }
4012
- );
4013
- }
4014
-
4015
- const validators$1 = {};
4016
-
4017
- // eslint-disable-next-line func-names
4018
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
4019
- validators$1[type] = function validator(thing) {
4020
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
4021
- };
4022
- });
4023
-
4024
- const deprecatedWarnings = {};
4025
-
4026
- /**
4027
- * Transitional option validator
4028
- *
4029
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
4030
- * @param {string?} version - deprecated version / removed since version
4031
- * @param {string?} message - some message with additional info
4032
- *
4033
- * @returns {function}
4034
- */
4035
- validators$1.transitional = function transitional(validator, version, message) {
4036
- function formatMessage(opt, desc) {
4037
- return (
4038
- '[Axios v' +
4039
- VERSION +
4040
- "] Transitional option '" +
4041
- opt +
4042
- "'" +
4043
- desc +
4044
- (message ? '. ' + message : '')
4045
- );
4046
- }
4047
-
4048
- // eslint-disable-next-line func-names
4049
- return (value, opt, opts) => {
4050
- if (validator === false) {
4051
- throw new AxiosError(
4052
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
4053
- AxiosError.ERR_DEPRECATED
4054
- );
4055
- }
4056
-
4057
- if (version && !deprecatedWarnings[opt]) {
4058
- deprecatedWarnings[opt] = true;
4059
- // eslint-disable-next-line no-console
4060
- console.warn(
4061
- formatMessage(
4062
- opt,
4063
- ' has been deprecated since v' + version + ' and will be removed in the near future'
4064
- )
4065
- );
4066
- }
4067
-
4068
- return validator ? validator(value, opt, opts) : true;
4069
- };
4070
- };
4071
-
4072
- validators$1.spelling = function spelling(correctSpelling) {
4073
- return (value, opt) => {
4074
- // eslint-disable-next-line no-console
4075
- console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
4076
- return true;
4077
- };
4078
- };
4079
-
4080
- /**
4081
- * Assert object's properties type
4082
- *
4083
- * @param {object} options
4084
- * @param {object} schema
4085
- * @param {boolean?} allowUnknown
4086
- *
4087
- * @returns {object}
4088
- */
4089
-
4090
- function assertOptions(options, schema, allowUnknown) {
4091
- if (typeof options !== 'object') {
4092
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
4093
- }
4094
- const keys = Object.keys(options);
4095
- let i = keys.length;
4096
- while (i-- > 0) {
4097
- const opt = keys[i];
4098
- // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
4099
- // a non-function validator and cause a TypeError.
4100
- const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
4101
- if (validator) {
4102
- const value = options[opt];
4103
- const result = value === undefined || validator(value, opt, options);
4104
- if (result !== true) {
4105
- throw new AxiosError(
4106
- 'option ' + opt + ' must be ' + result,
4107
- AxiosError.ERR_BAD_OPTION_VALUE
4108
- );
4109
- }
4110
- continue;
4111
- }
4112
- if (allowUnknown !== true) {
4113
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
4114
- }
4115
- }
4116
- }
4117
-
4118
- var validator = {
4119
- assertOptions,
4120
- validators: validators$1,
4121
- };
4122
-
4123
- const validators = validator.validators;
4124
-
4125
- /**
4126
- * Create a new instance of Axios
4127
- *
4128
- * @param {Object} instanceConfig The default config for the instance
4129
- *
4130
- * @return {Axios} A new instance of Axios
4131
- */
4132
- class Axios {
4133
- constructor(instanceConfig) {
4134
- this.defaults = instanceConfig || {};
4135
- this.interceptors = {
4136
- request: new InterceptorManager(),
4137
- response: new InterceptorManager(),
4138
- };
4139
- }
4140
-
4141
- /**
4142
- * Dispatch a request
4143
- *
4144
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
4145
- * @param {?Object} config
4146
- *
4147
- * @returns {Promise} The Promise to be fulfilled
4148
- */
4149
- async request(configOrUrl, config) {
4150
- try {
4151
- return await this._request(configOrUrl, config);
4152
- } catch (err) {
4153
- if (err instanceof Error) {
4154
- let dummy = {};
4155
-
4156
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
4157
-
4158
- // slice off the Error: ... line
4159
- const stack = (() => {
4160
- if (!dummy.stack) {
4161
- return '';
4162
- }
4163
-
4164
- const firstNewlineIndex = dummy.stack.indexOf('\n');
4165
-
4166
- return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
4167
- })();
4168
- try {
4169
- if (!err.stack) {
4170
- err.stack = stack;
4171
- // match without the 2 top stack lines
4172
- } else if (stack) {
4173
- const firstNewlineIndex = stack.indexOf('\n');
4174
- const secondNewlineIndex =
4175
- firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
4176
- const stackWithoutTwoTopLines =
4177
- secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
4178
-
4179
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
4180
- err.stack += '\n' + stack;
4181
- }
4182
- }
4183
- } catch (e) {
4184
- // ignore the case where "stack" is an un-writable property
4185
- }
4186
- }
4187
-
4188
- throw err;
4189
- }
4190
- }
4191
-
4192
- _request(configOrUrl, config) {
4193
- /*eslint no-param-reassign:0*/
4194
- // Allow for axios('example/url'[, config]) a la fetch API
4195
- if (typeof configOrUrl === 'string') {
4196
- config = config || {};
4197
- config.url = configOrUrl;
4198
- } else {
4199
- config = configOrUrl || {};
4200
- }
4201
-
4202
- config = mergeConfig(this.defaults, config);
4203
-
4204
- const { transitional, paramsSerializer, headers } = config;
4205
-
4206
- if (transitional !== undefined) {
4207
- validator.assertOptions(
4208
- transitional,
4209
- {
4210
- silentJSONParsing: validators.transitional(validators.boolean),
4211
- forcedJSONParsing: validators.transitional(validators.boolean),
4212
- clarifyTimeoutError: validators.transitional(validators.boolean),
4213
- legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
4214
- },
4215
- false
4216
- );
4217
- }
4218
-
4219
- if (paramsSerializer != null) {
4220
- if (utils$1.isFunction(paramsSerializer)) {
4221
- config.paramsSerializer = {
4222
- serialize: paramsSerializer,
4223
- };
4224
- } else {
4225
- validator.assertOptions(
4226
- paramsSerializer,
4227
- {
4228
- encode: validators.function,
4229
- serialize: validators.function,
4230
- },
4231
- true
4232
- );
4233
- }
4234
- }
4235
-
4236
- // Set config.allowAbsoluteUrls
4237
- if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
4238
- config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
4239
- } else {
4240
- config.allowAbsoluteUrls = true;
4241
- }
4242
-
4243
- validator.assertOptions(
4244
- config,
4245
- {
4246
- baseUrl: validators.spelling('baseURL'),
4247
- withXsrfToken: validators.spelling('withXSRFToken'),
4248
- },
4249
- true
4250
- );
4251
-
4252
- // Set config.method
4253
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
4254
-
4255
- // Flatten headers
4256
- let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
4257
-
4258
- headers &&
4259
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
4260
- delete headers[method];
4261
- });
4262
-
4263
- config.headers = AxiosHeaders.concat(contextHeaders, headers);
4264
-
4265
- // filter out skipped interceptors
4266
- const requestInterceptorChain = [];
4267
- let synchronousRequestInterceptors = true;
4268
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
4269
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
4270
- return;
4271
- }
4272
-
4273
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
4274
-
4275
- const transitional = config.transitional || transitionalDefaults;
4276
- const legacyInterceptorReqResOrdering =
4277
- transitional && transitional.legacyInterceptorReqResOrdering;
4278
-
4279
- if (legacyInterceptorReqResOrdering) {
4280
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
4281
- } else {
4282
- requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
4283
- }
4284
- });
4285
-
4286
- const responseInterceptorChain = [];
4287
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
4288
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
4289
- });
4290
-
4291
- let promise;
4292
- let i = 0;
4293
- let len;
4294
-
4295
- if (!synchronousRequestInterceptors) {
4296
- const chain = [dispatchRequest.bind(this), undefined];
4297
- chain.unshift(...requestInterceptorChain);
4298
- chain.push(...responseInterceptorChain);
4299
- len = chain.length;
4300
-
4301
- promise = Promise.resolve(config);
4302
-
4303
- while (i < len) {
4304
- promise = promise.then(chain[i++], chain[i++]);
4305
- }
4306
-
4307
- return promise;
4308
- }
4309
-
4310
- len = requestInterceptorChain.length;
4311
-
4312
- let newConfig = config;
4313
-
4314
- while (i < len) {
4315
- const onFulfilled = requestInterceptorChain[i++];
4316
- const onRejected = requestInterceptorChain[i++];
4317
- try {
4318
- newConfig = onFulfilled(newConfig);
4319
- } catch (error) {
4320
- onRejected.call(this, error);
4321
- break;
4322
- }
4323
- }
4324
-
4325
- try {
4326
- promise = dispatchRequest.call(this, newConfig);
4327
- } catch (error) {
4328
- return Promise.reject(error);
4329
- }
4330
-
4331
- i = 0;
4332
- len = responseInterceptorChain.length;
4333
-
4334
- while (i < len) {
4335
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
4336
- }
4337
-
4338
- return promise;
4339
- }
4340
-
4341
- getUri(config) {
4342
- config = mergeConfig(this.defaults, config);
4343
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4344
- return buildURL(fullPath, config.params, config.paramsSerializer);
4345
- }
4346
- }
4347
-
4348
- // Provide aliases for supported request methods
4349
- utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
4350
- /*eslint func-names:0*/
4351
- Axios.prototype[method] = function (url, config) {
4352
- return this.request(
4353
- mergeConfig(config || {}, {
4354
- method,
4355
- url,
4356
- data: (config || {}).data,
4357
- })
4358
- );
4359
- };
4360
- });
4361
-
4362
- utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
4363
- function generateHTTPMethod(isForm) {
4364
- return function httpMethod(url, data, config) {
4365
- return this.request(
4366
- mergeConfig(config || {}, {
4367
- method,
4368
- headers: isForm
4369
- ? {
4370
- 'Content-Type': 'multipart/form-data',
4371
- }
4372
- : {},
4373
- url,
4374
- data,
4375
- })
4376
- );
4377
- };
4378
- }
4379
-
4380
- Axios.prototype[method] = generateHTTPMethod();
4381
-
4382
- // QUERY is a safe/idempotent read method; multipart form bodies don't fit
4383
- // its semantics, so no queryForm shorthand is generated.
4384
- if (method !== 'query') {
4385
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4386
- }
4387
- });
4388
-
4389
- /**
4390
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
4391
- *
4392
- * @param {Function} executor The executor function.
4393
- *
4394
- * @returns {CancelToken}
4395
- */
4396
- class CancelToken {
4397
- constructor(executor) {
4398
- if (typeof executor !== 'function') {
4399
- throw new TypeError('executor must be a function.');
4400
- }
4401
-
4402
- let resolvePromise;
4403
-
4404
- this.promise = new Promise(function promiseExecutor(resolve) {
4405
- resolvePromise = resolve;
4406
- });
4407
-
4408
- const token = this;
4409
-
4410
- // eslint-disable-next-line func-names
4411
- this.promise.then((cancel) => {
4412
- if (!token._listeners) return;
4413
-
4414
- let i = token._listeners.length;
4415
-
4416
- while (i-- > 0) {
4417
- token._listeners[i](cancel);
4418
- }
4419
- token._listeners = null;
4420
- });
4421
-
4422
- // eslint-disable-next-line func-names
4423
- this.promise.then = (onfulfilled) => {
4424
- let _resolve;
4425
- // eslint-disable-next-line func-names
4426
- const promise = new Promise((resolve) => {
4427
- token.subscribe(resolve);
4428
- _resolve = resolve;
4429
- }).then(onfulfilled);
4430
-
4431
- promise.cancel = function reject() {
4432
- token.unsubscribe(_resolve);
4433
- };
4434
-
4435
- return promise;
4436
- };
4437
-
4438
- executor(function cancel(message, config, request) {
4439
- if (token.reason) {
4440
- // Cancellation has already been requested
4441
- return;
4442
- }
4443
-
4444
- token.reason = new CanceledError(message, config, request);
4445
- resolvePromise(token.reason);
4446
- });
4447
- }
4448
-
4449
- /**
4450
- * Throws a `CanceledError` if cancellation has been requested.
4451
- */
4452
- throwIfRequested() {
4453
- if (this.reason) {
4454
- throw this.reason;
4455
- }
4456
- }
4457
-
4458
- /**
4459
- * Subscribe to the cancel signal
4460
- */
4461
-
4462
- subscribe(listener) {
4463
- if (this.reason) {
4464
- listener(this.reason);
4465
- return;
4466
- }
4467
-
4468
- if (this._listeners) {
4469
- this._listeners.push(listener);
4470
- } else {
4471
- this._listeners = [listener];
4472
- }
4473
- }
4474
-
4475
- /**
4476
- * Unsubscribe from the cancel signal
4477
- */
4478
-
4479
- unsubscribe(listener) {
4480
- if (!this._listeners) {
4481
- return;
4482
- }
4483
- const index = this._listeners.indexOf(listener);
4484
- if (index !== -1) {
4485
- this._listeners.splice(index, 1);
4486
- }
4487
- }
4488
-
4489
- toAbortSignal() {
4490
- const controller = new AbortController();
4491
-
4492
- const abort = (err) => {
4493
- controller.abort(err);
4494
- };
4495
-
4496
- this.subscribe(abort);
4497
-
4498
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
4499
-
4500
- return controller.signal;
4501
- }
4502
-
4503
- /**
4504
- * Returns an object that contains a new `CancelToken` and a function that, when called,
4505
- * cancels the `CancelToken`.
4506
- */
4507
- static source() {
4508
- let cancel;
4509
- const token = new CancelToken(function executor(c) {
4510
- cancel = c;
4511
- });
4512
- return {
4513
- token,
4514
- cancel,
4515
- };
4516
- }
4517
- }
4518
-
4519
- /**
4520
- * Syntactic sugar for invoking a function and expanding an array for arguments.
4521
- *
4522
- * Common use case would be to use `Function.prototype.apply`.
4523
- *
4524
- * ```js
4525
- * function f(x, y, z) {}
4526
- * const args = [1, 2, 3];
4527
- * f.apply(null, args);
4528
- * ```
4529
- *
4530
- * With `spread` this example can be re-written.
4531
- *
4532
- * ```js
4533
- * spread(function(x, y, z) {})([1, 2, 3]);
4534
- * ```
4535
- *
4536
- * @param {Function} callback
4537
- *
4538
- * @returns {Function}
4539
- */
4540
- function spread(callback) {
4541
- return function wrap(arr) {
4542
- return callback.apply(null, arr);
4543
- };
4544
- }
4545
-
4546
- /**
4547
- * Determines whether the payload is an error thrown by Axios
4548
- *
4549
- * @param {*} payload The value to test
4550
- *
4551
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
4552
- */
4553
- function isAxiosError(payload) {
4554
- return utils$1.isObject(payload) && payload.isAxiosError === true;
4555
- }
4556
-
4557
- const HttpStatusCode = {
4558
- Continue: 100,
4559
- SwitchingProtocols: 101,
4560
- Processing: 102,
4561
- EarlyHints: 103,
4562
- Ok: 200,
4563
- Created: 201,
4564
- Accepted: 202,
4565
- NonAuthoritativeInformation: 203,
4566
- NoContent: 204,
4567
- ResetContent: 205,
4568
- PartialContent: 206,
4569
- MultiStatus: 207,
4570
- AlreadyReported: 208,
4571
- ImUsed: 226,
4572
- MultipleChoices: 300,
4573
- MovedPermanently: 301,
4574
- Found: 302,
4575
- SeeOther: 303,
4576
- NotModified: 304,
4577
- UseProxy: 305,
4578
- Unused: 306,
4579
- TemporaryRedirect: 307,
4580
- PermanentRedirect: 308,
4581
- BadRequest: 400,
4582
- Unauthorized: 401,
4583
- PaymentRequired: 402,
4584
- Forbidden: 403,
4585
- NotFound: 404,
4586
- MethodNotAllowed: 405,
4587
- NotAcceptable: 406,
4588
- ProxyAuthenticationRequired: 407,
4589
- RequestTimeout: 408,
4590
- Conflict: 409,
4591
- Gone: 410,
4592
- LengthRequired: 411,
4593
- PreconditionFailed: 412,
4594
- PayloadTooLarge: 413,
4595
- UriTooLong: 414,
4596
- UnsupportedMediaType: 415,
4597
- RangeNotSatisfiable: 416,
4598
- ExpectationFailed: 417,
4599
- ImATeapot: 418,
4600
- MisdirectedRequest: 421,
4601
- UnprocessableEntity: 422,
4602
- Locked: 423,
4603
- FailedDependency: 424,
4604
- TooEarly: 425,
4605
- UpgradeRequired: 426,
4606
- PreconditionRequired: 428,
4607
- TooManyRequests: 429,
4608
- RequestHeaderFieldsTooLarge: 431,
4609
- UnavailableForLegalReasons: 451,
4610
- InternalServerError: 500,
4611
- NotImplemented: 501,
4612
- BadGateway: 502,
4613
- ServiceUnavailable: 503,
4614
- GatewayTimeout: 504,
4615
- HttpVersionNotSupported: 505,
4616
- VariantAlsoNegotiates: 506,
4617
- InsufficientStorage: 507,
4618
- LoopDetected: 508,
4619
- NotExtended: 510,
4620
- NetworkAuthenticationRequired: 511,
4621
- WebServerIsDown: 521,
4622
- ConnectionTimedOut: 522,
4623
- OriginIsUnreachable: 523,
4624
- TimeoutOccurred: 524,
4625
- SslHandshakeFailed: 525,
4626
- InvalidSslCertificate: 526,
4627
- };
4628
-
4629
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
4630
- HttpStatusCode[value] = key;
4631
- });
4632
-
4633
- /**
4634
- * Create an instance of Axios
4635
- *
4636
- * @param {Object} defaultConfig The default config for the instance
4637
- *
4638
- * @returns {Axios} A new instance of Axios
4639
- */
4640
- function createInstance(defaultConfig) {
4641
- const context = new Axios(defaultConfig);
4642
- const instance = bind(Axios.prototype.request, context);
4643
-
4644
- // Copy axios.prototype to instance
4645
- utils$1.extend(instance, Axios.prototype, context, { allOwnKeys: true });
4646
-
4647
- // Copy context to instance
4648
- utils$1.extend(instance, context, null, { allOwnKeys: true });
4649
-
4650
- // Factory for creating new instances
4651
- instance.create = function create(instanceConfig) {
4652
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
4653
- };
4654
-
4655
- return instance;
4656
- }
4657
-
4658
- // Create the default instance to be exported
4659
- const axios = createInstance(defaults);
4660
-
4661
- // Expose Axios class to allow class inheritance
4662
- axios.Axios = Axios;
4663
-
4664
- // Expose Cancel & CancelToken
4665
- axios.CanceledError = CanceledError;
4666
- axios.CancelToken = CancelToken;
4667
- axios.isCancel = isCancel;
4668
- axios.VERSION = VERSION;
4669
- axios.toFormData = toFormData;
4670
-
4671
- // Expose AxiosError class
4672
- axios.AxiosError = AxiosError;
4673
-
4674
- // alias for CanceledError for backward compatibility
4675
- axios.Cancel = axios.CanceledError;
4676
-
4677
- // Expose all/spread
4678
- axios.all = function all(promises) {
4679
- return Promise.all(promises);
4680
- };
4681
-
4682
- axios.spread = spread;
4683
-
4684
- // Expose isAxiosError
4685
- axios.isAxiosError = isAxiosError;
4686
-
4687
- // Expose mergeConfig
4688
- axios.mergeConfig = mergeConfig;
4689
-
4690
- axios.AxiosHeaders = AxiosHeaders;
4691
-
4692
- axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4693
-
4694
- axios.getAdapter = adapters.getAdapter;
4695
-
4696
- axios.HttpStatusCode = HttpStatusCode;
4697
-
4698
- axios.default = axios;
4699
-
4700
- module.exports = axios;
4701
- //# sourceMappingURL=axios.cjs.map