@ued_fpi/data-visual 1.0.11 → 1.1.1

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