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