@jobber/components 4.85.5 → 4.85.6-CJS-to-ESM.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 (606) hide show
  1. package/dist/AnimatedPresence/{index.js → index.cjs} +1 -3
  2. package/dist/AnimatedPresence/index.mjs +4 -0
  3. package/dist/AnimatedPresence-D73apgLB.js +98 -0
  4. package/dist/{AnimatedPresence-20a02aaa.js → AnimatedPresence-DFaAEYUa.js} +3 -7
  5. package/dist/AnimatedSwitcher/index.cjs +11 -0
  6. package/dist/AnimatedSwitcher/index.mjs +5 -0
  7. package/dist/AnimatedSwitcher-B4fUExeN.js +90 -0
  8. package/dist/{AnimatedSwitcher-3d45ec5d.js → AnimatedSwitcher-UmlTf067.js} +4 -8
  9. package/dist/Autocomplete/index.cjs +34 -0
  10. package/dist/Autocomplete/index.mjs +28 -0
  11. package/dist/{Autocomplete/index.js → Autocomplete-CDpl009j.js} +24 -43
  12. package/dist/Autocomplete-DcuJsI7Z.js +188 -0
  13. package/dist/Avatar/index.cjs +13 -0
  14. package/dist/Avatar/index.mjs +7 -0
  15. package/dist/Avatar-DZCQBKMr.js +70 -0
  16. package/dist/Avatar-Q2BQymsE.js +72 -0
  17. package/dist/Banner/components/BannerIcon/index.cjs +13 -0
  18. package/dist/Banner/components/BannerIcon/index.mjs +7 -0
  19. package/dist/Banner/index.cjs +19 -0
  20. package/dist/Banner/index.mjs +13 -0
  21. package/dist/Banner-B230_jsV.js +84 -0
  22. package/dist/Banner-zMyKdO1y.js +82 -0
  23. package/dist/BannerIcon-QB3lZddm.js +24 -0
  24. package/dist/BannerIcon-YIreWKuC.js +27 -0
  25. package/dist/Body-DMRyfeGa.js +59 -0
  26. package/dist/Body-Dd2-HEDo.js +50 -0
  27. package/dist/Button/index.cjs +14 -0
  28. package/dist/Button/index.mjs +8 -0
  29. package/dist/Button-CWVwgwhn.js +50 -0
  30. package/dist/Button-D3mW3Hcg.js +52 -0
  31. package/dist/ButtonDismiss/index.cjs +15 -0
  32. package/dist/ButtonDismiss/index.mjs +9 -0
  33. package/dist/ButtonDismiss-GLptCaNc.js +8 -0
  34. package/dist/ButtonDismiss-l6Kunmen.js +10 -0
  35. package/dist/Card/index.cjs +22 -0
  36. package/dist/Card/index.mjs +16 -0
  37. package/dist/{Card-e3144022.js → Card-0WPJWxfz.js} +20 -25
  38. package/dist/Card-BOD8v9wH.js +86 -0
  39. package/dist/Checkbox/index.cjs +16 -0
  40. package/dist/Checkbox/index.mjs +10 -0
  41. package/dist/Checkbox-C78HDAVJ.js +58 -0
  42. package/dist/Checkbox-qsepteuE.js +56 -0
  43. package/dist/Chip/hooks/index.cjs +8 -0
  44. package/dist/Chip/hooks/index.mjs +2 -0
  45. package/dist/Chip/index.cjs +26 -0
  46. package/dist/Chip/index.mjs +18 -0
  47. package/dist/Chip-Div4v8At.js +73 -0
  48. package/dist/Chip-tWHAQezL.js +70 -0
  49. package/dist/ChipDismissible-B0DslYTJ.js +22 -0
  50. package/dist/ChipDismissible-DSLoDRyq.js +19 -0
  51. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +24 -0
  52. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +14 -0
  53. package/dist/Chips/InternalChipDismissible/index.cjs +35 -0
  54. package/dist/Chips/InternalChipDismissible/index.mjs +29 -0
  55. package/dist/Chips/index.cjs +48 -0
  56. package/dist/Chips/index.mjs +44 -0
  57. package/dist/Chips-DzPxRiFY.js +91 -0
  58. package/dist/Chips-tdDqEKfy.js +93 -0
  59. package/dist/Combobox/components/ComboboxAction/index.cjs +13 -0
  60. package/dist/Combobox/components/ComboboxAction/index.mjs +7 -0
  61. package/dist/Combobox/components/ComboboxActivator/index.cjs +27 -0
  62. package/dist/Combobox/components/ComboboxActivator/index.mjs +21 -0
  63. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.cjs +15 -0
  64. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/index.mjs +9 -0
  65. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.cjs +25 -0
  66. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/index.mjs +19 -0
  67. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.cjs +11 -0
  68. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/index.mjs +5 -0
  69. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.cjs +10 -0
  70. package/dist/Combobox/components/ComboboxContent/ComboboxLoadMore/index.mjs +4 -0
  71. package/dist/Combobox/components/ComboboxContent/index.cjs +35 -0
  72. package/dist/Combobox/components/ComboboxContent/index.mjs +29 -0
  73. package/dist/Combobox/components/ComboboxOption/index.cjs +15 -0
  74. package/dist/Combobox/components/ComboboxOption/index.mjs +9 -0
  75. package/dist/Combobox/components/ComboboxTrigger/index.cjs +25 -0
  76. package/dist/Combobox/components/ComboboxTrigger/index.mjs +19 -0
  77. package/dist/Combobox/index.cjs +52 -0
  78. package/dist/Combobox/index.mjs +45 -0
  79. package/dist/Combobox-BwSFlPWt.js +120 -0
  80. package/dist/Combobox-Dr5ftH9X.js +122 -0
  81. package/dist/ComboboxAction-B3RwsCtx.js +27 -0
  82. package/dist/ComboboxAction-BzEwYtPm.js +25 -0
  83. package/dist/ComboboxActivator-B-2nmWQ-.js +28 -0
  84. package/dist/ComboboxActivator-DkcbNfv5.js +26 -0
  85. package/dist/ComboboxContent-B108quRR.js +144 -0
  86. package/dist/ComboboxContent-D44NnZaD.js +146 -0
  87. package/dist/ComboboxContentHeader-CJ0if4JI.js +32 -0
  88. package/dist/ComboboxContentHeader-DFLlxg-X.js +30 -0
  89. package/dist/ComboboxContentList-DHQ0x2ml.js +80 -0
  90. package/dist/ComboboxContentList-DmdT_cqp.js +78 -0
  91. package/dist/ComboboxContentSearch-B8hsfo_D.js +35 -0
  92. package/dist/ComboboxContentSearch-UAyHetvM.js +37 -0
  93. package/dist/ComboboxLoadMore-C3JuiaZf.js +17 -0
  94. package/dist/ComboboxLoadMore-Dk2tUBxS.js +19 -0
  95. package/dist/ComboboxOption-CWkyTkzU.js +25 -0
  96. package/dist/ComboboxOption-D_f4NcBM.js +23 -0
  97. package/dist/ComboboxProvider-BwxfVgmL.js +13 -0
  98. package/dist/ComboboxProvider-Dm_tfmkr.js +10 -0
  99. package/dist/ComboboxTrigger-BAOfY8Og.js +22 -0
  100. package/dist/ComboboxTrigger-ZqNl11Qy.js +24 -0
  101. package/dist/ConfirmationModal/index.cjs +29 -0
  102. package/dist/ConfirmationModal/index.mjs +23 -0
  103. package/dist/ConfirmationModal-CPNH-chF.js +94 -0
  104. package/dist/{ConfirmationModal-52e16873.js → ConfirmationModal-CZTiORX4.js} +6 -10
  105. package/dist/Content/index.cjs +10 -0
  106. package/dist/Content/index.mjs +4 -0
  107. package/dist/Content-B8Od1cqS.js +20 -0
  108. package/dist/Content-BknIp35w.js +18 -0
  109. package/dist/Countdown/index.cjs +10 -0
  110. package/dist/Countdown/index.mjs +4 -0
  111. package/dist/Countdown-DQYi_QSJ.js +63 -0
  112. package/dist/{Countdown/index.js → Countdown-mTio5lCJ.js} +2 -9
  113. package/dist/DataDump/index.cjs +25 -0
  114. package/dist/DataDump/index.mjs +19 -0
  115. package/dist/DataDump-BhkXdMFl.js +15 -0
  116. package/dist/DataDump-BoNQd_3r.js +17 -0
  117. package/dist/DataList/components/DataListAction/index.cjs +14 -0
  118. package/dist/DataList/components/DataListAction/index.mjs +8 -0
  119. package/dist/DataList/components/DataListActions/index.cjs +43 -0
  120. package/dist/DataList/components/DataListActions/index.mjs +37 -0
  121. package/dist/DataList/components/DataListActionsMenu/index.cjs +16 -0
  122. package/dist/DataList/components/DataListActionsMenu/index.mjs +10 -0
  123. package/dist/DataList/components/DataListBulkActions/index.cjs +46 -0
  124. package/dist/DataList/components/DataListBulkActions/index.mjs +39 -0
  125. package/dist/DataList/components/DataListEmptyState/index.cjs +21 -0
  126. package/dist/DataList/components/DataListEmptyState/index.mjs +14 -0
  127. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +53 -0
  128. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +47 -0
  129. package/dist/DataList/components/DataListFilters/index.cjs +67 -0
  130. package/dist/DataList/components/DataListFilters/index.mjs +60 -0
  131. package/dist/DataList/components/DataListHeader/index.cjs +53 -0
  132. package/dist/DataList/components/DataListHeader/index.mjs +47 -0
  133. package/dist/DataList/components/DataListHeaderTile/components/index.cjs +13 -0
  134. package/dist/DataList/components/DataListHeaderTile/components/index.mjs +7 -0
  135. package/dist/DataList/components/DataListHeaderTile/index.cjs +21 -0
  136. package/dist/DataList/components/DataListHeaderTile/index.mjs +15 -0
  137. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.cjs +15 -0
  138. package/dist/DataList/components/DataListItem/components/DataListItemClickable/index.mjs +9 -0
  139. package/dist/DataList/components/DataListItem/index.cjs +52 -0
  140. package/dist/DataList/components/DataListItem/index.mjs +46 -0
  141. package/dist/DataList/components/DataListItemActions/index.cjs +45 -0
  142. package/dist/DataList/components/DataListItemActions/index.mjs +38 -0
  143. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +25 -0
  144. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +19 -0
  145. package/dist/DataList/components/DataListItems/index.cjs +53 -0
  146. package/dist/DataList/components/DataListItems/index.mjs +47 -0
  147. package/dist/DataList/components/DataListLayout/index.cjs +56 -0
  148. package/dist/DataList/components/DataListLayout/index.mjs +50 -0
  149. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.cjs +9 -0
  150. package/dist/DataList/components/DataListLayoutActions/DataListLayoutContext/index.mjs +2 -0
  151. package/dist/DataList/components/DataListLayoutActions/index.cjs +33 -0
  152. package/dist/DataList/components/DataListLayoutActions/index.mjs +27 -0
  153. package/dist/DataList/components/DataListLoadMore/index.cjs +22 -0
  154. package/dist/DataList/components/DataListLoadMore/index.mjs +15 -0
  155. package/dist/DataList/components/DataListLoadingState/index.cjs +22 -0
  156. package/dist/DataList/components/DataListLoadingState/index.mjs +14 -0
  157. package/dist/DataList/components/DataListOverflowFade/index.cjs +12 -0
  158. package/dist/DataList/components/DataListOverflowFade/index.mjs +5 -0
  159. package/dist/DataList/components/DataListSearch/index.cjs +35 -0
  160. package/dist/DataList/components/DataListSearch/index.mjs +27 -0
  161. package/dist/DataList/components/DataListStatusBar/index.cjs +32 -0
  162. package/dist/DataList/components/DataListStatusBar/index.mjs +25 -0
  163. package/dist/DataList/components/DataListStickyHeader/index.cjs +12 -0
  164. package/dist/DataList/components/DataListStickyHeader/index.mjs +6 -0
  165. package/dist/DataList/components/DataListTags/index.cjs +13 -0
  166. package/dist/DataList/components/DataListTags/index.mjs +7 -0
  167. package/dist/DataList/components/DataListTotalCount/index.cjs +16 -0
  168. package/dist/DataList/components/DataListTotalCount/index.mjs +9 -0
  169. package/dist/DataList/context/DataListContext/index.cjs +12 -0
  170. package/dist/DataList/context/DataListContext/index.mjs +4 -0
  171. package/dist/DataList/context/DataListLayoutContext/index.cjs +12 -0
  172. package/dist/DataList/context/DataListLayoutContext/index.mjs +4 -0
  173. package/dist/DataList/index.cjs +98 -0
  174. package/dist/DataList/index.mjs +92 -0
  175. package/dist/DataList-BL3zeA83.js +9 -0
  176. package/dist/DataList-D8rsiB6p.js +7 -0
  177. package/dist/DataList-DcPfsE4o.js +141 -0
  178. package/dist/DataList-UzxXqfXV.js +139 -0
  179. package/dist/DataList.const-Wz370ukq.js +25 -0
  180. package/dist/DataList.const-YbvF2-QB.js +38 -0
  181. package/dist/DataList.utils-B0hOFZaX.js +168 -0
  182. package/dist/DataList.utils-C931OWj0.js +161 -0
  183. package/dist/DataListAction-CMZbwbN5.js +40 -0
  184. package/dist/DataListAction-CzSLV230.js +42 -0
  185. package/dist/DataListActions-D2xI1Gnz.js +45 -0
  186. package/dist/DataListActions-DYrocbl7.js +43 -0
  187. package/dist/DataListActionsMenu-3JxvPbGZ.js +53 -0
  188. package/dist/DataListActionsMenu-CjBKmZT6.js +55 -0
  189. package/dist/DataListBulkActions-BSjCVCSw.js +32 -0
  190. package/dist/DataListBulkActions-OLJ1EzI6.js +29 -0
  191. package/dist/DataListContext-CWEeA357.js +29 -0
  192. package/dist/DataListContext-DHdRjGCC.js +25 -0
  193. package/dist/DataListEmptyState-CvRFHlYt.js +56 -0
  194. package/dist/DataListEmptyState-Rk1OowmR.js +53 -0
  195. package/dist/DataListFilters-Dfw7ptNa.js +46 -0
  196. package/dist/DataListFilters-y0CrJgWe.js +43 -0
  197. package/dist/DataListHeader-BFg0X9Jz.js +95 -0
  198. package/dist/DataListHeader-DB1ikJ1G.js +93 -0
  199. package/dist/DataListHeaderTile-BcvpRQqc.js +86 -0
  200. package/dist/DataListHeaderTile-CUaHgFkG.js +84 -0
  201. package/dist/DataListItem-27SGm5NU.js +114 -0
  202. package/dist/DataListItem-CEcG1clf.js +112 -0
  203. package/dist/DataListItemActions-B0IR13cA.js +35 -0
  204. package/dist/DataListItemActions-DbMxVTo5.js +32 -0
  205. package/dist/DataListItemActionsOverflow-B1XTLLAZ.js +33 -0
  206. package/dist/DataListItemActionsOverflow-Dt1rZ_ch.js +35 -0
  207. package/dist/DataListItemClickable-CPGV8QJU.js +47 -0
  208. package/dist/DataListItemClickable-a9vfumwQ.js +45 -0
  209. package/dist/DataListItems-C37QwFLL.js +21 -0
  210. package/dist/DataListItems-CmmwaaoF.js +19 -0
  211. package/dist/DataListLayout-BkqOAi5X.js +19 -0
  212. package/dist/DataListLayout-fuctDjAR.js +21 -0
  213. package/dist/DataListLayoutActions-BrXEXuWB.js +41 -0
  214. package/dist/DataListLayoutActions-C1xVkV8F.js +39 -0
  215. package/dist/DataListLayoutContext-BiMbo7LQ.js +18 -0
  216. package/dist/DataListLayoutContext-D3REliDa.js +8 -0
  217. package/dist/DataListLayoutContext-D5Jhd_ZG.js +14 -0
  218. package/dist/DataListLayoutContext-DT0mtKzt.js +11 -0
  219. package/dist/DataListLoadMore-BThmoeQ0.js +37 -0
  220. package/dist/DataListLoadMore-eMdC9JGb.js +34 -0
  221. package/dist/DataListLoadingState-BovqtnV7.js +29 -0
  222. package/dist/DataListLoadingState-DKSypijq.js +25 -0
  223. package/dist/DataListOverflowFade-DUocP0Jz.js +25 -0
  224. package/dist/DataListOverflowFade-DxUdWrD0.js +28 -0
  225. package/dist/DataListSearch-D0pqhE8d.js +66 -0
  226. package/dist/DataListSearch-DiHOG8VU.js +62 -0
  227. package/dist/DataListSort-CQ62ewRY.js +94 -0
  228. package/dist/DataListSort-CW4v1psG.js +92 -0
  229. package/dist/DataListSortingOptions-BGNu0KOG.js +38 -0
  230. package/dist/DataListSortingOptions-ZiARzP5b.js +40 -0
  231. package/dist/DataListStatusBar-EQKC5MHS.js +22 -0
  232. package/dist/DataListStatusBar-Va-ssWph.js +25 -0
  233. package/dist/DataListStickyHeader-BKN9V51R.js +28 -0
  234. package/dist/DataListStickyHeader-CCG09E7V.js +26 -0
  235. package/dist/DataListTags-C5inHFOR.js +67 -0
  236. package/dist/DataListTags-CHZr9DW3.js +65 -0
  237. package/dist/DataListTotalCount-B9K3hGqp.js +30 -0
  238. package/dist/DataListTotalCount-Dzzm_buN.js +27 -0
  239. package/dist/DataTable/index.cjs +34 -0
  240. package/dist/DataTable/index.mjs +23 -0
  241. package/dist/DataTable/test-utilities/index.cjs +241 -0
  242. package/dist/DataTable/test-utilities/index.mjs +233 -0
  243. package/dist/DataTable-BOZ_Zf4q.js +245 -0
  244. package/dist/DataTable-D1Q5tABs.js +247 -0
  245. package/dist/DatePicker/index.cjs +24 -0
  246. package/dist/DatePicker/index.mjs +18 -0
  247. package/dist/DatePicker-CqYEsDX3.js +1279 -0
  248. package/dist/DatePicker-DBObDXoW.js +1282 -0
  249. package/dist/DayOfMonthSelect--s7Ry-jx.js +141 -0
  250. package/dist/DayOfMonthSelect-UlE6seGW.js +148 -0
  251. package/dist/DescriptionList/index.cjs +11 -0
  252. package/dist/DescriptionList/index.mjs +5 -0
  253. package/dist/DescriptionList-CBeTDl49.js +15 -0
  254. package/dist/DescriptionList-DBENvQT5.js +17 -0
  255. package/dist/Disclosure/index.cjs +14 -0
  256. package/dist/Disclosure/index.mjs +8 -0
  257. package/dist/Disclosure-Bikm1B9V.js +38 -0
  258. package/dist/Disclosure-D7kJi1Df.js +36 -0
  259. package/dist/Divider/index.cjs +10 -0
  260. package/dist/Divider/index.mjs +4 -0
  261. package/dist/Divider-DOmpOAKU.js +20 -0
  262. package/dist/{Divider/index.js → Divider-Dt_qE9xe.js} +4 -11
  263. package/dist/Drawer/index.cjs +19 -0
  264. package/dist/Drawer/index.mjs +12 -0
  265. package/dist/DrawerGrid-Bg9ydPFR.js +33 -0
  266. package/dist/DrawerGrid-DM3WKmX6.js +36 -0
  267. package/dist/Emphasis/index.cjs +11 -0
  268. package/dist/Emphasis/index.mjs +5 -0
  269. package/dist/Emphasis-B3vf8Ek9.js +15 -0
  270. package/dist/Emphasis-xxFrrT2i.js +13 -0
  271. package/dist/FeatureSwitch/index.cjs +24 -0
  272. package/dist/FeatureSwitch/index.mjs +18 -0
  273. package/dist/FeatureSwitch-C1cXc0VS.js +55 -0
  274. package/dist/FeatureSwitch-C66nDoAy.js +57 -0
  275. package/dist/Flex/index.cjs +10 -0
  276. package/dist/Flex/index.mjs +4 -0
  277. package/dist/{Flex-d490c4db.js → Flex-CBKf3epb.js} +3 -8
  278. package/dist/Flex-DXDpEzMI.js +31 -0
  279. package/dist/Form/index.cjs +10 -0
  280. package/dist/Form/index.mjs +4 -0
  281. package/dist/{Form/index.js → Form-ChkdN1bx.js} +3 -9
  282. package/dist/Form-Dd9YKBh-.js +48 -0
  283. package/dist/FormField/index.cjs +22 -0
  284. package/dist/FormField/index.mjs +16 -0
  285. package/dist/FormField-BBg_JAlJ.js +248 -0
  286. package/dist/FormField-C-d0U7Ww.js +246 -0
  287. package/dist/FormatDate/{index.js → index.cjs} +1 -3
  288. package/dist/FormatDate/index.mjs +2 -0
  289. package/dist/{FormatDate-70ea5b43.js → FormatDate-BzJETLja.js} +1 -5
  290. package/dist/FormatDate-Dxs33-Xj.js +27 -0
  291. package/dist/FormatEmail/index.cjs +10 -0
  292. package/dist/FormatEmail/index.mjs +4 -0
  293. package/dist/FormatEmail-BH1qM7Va.js +16 -0
  294. package/dist/FormatEmail-_Ytrq7mn.js +14 -0
  295. package/dist/FormatFile/index.cjs +34 -0
  296. package/dist/FormatFile/index.mjs +28 -0
  297. package/dist/FormatFile-BQXjo6EG.js +154 -0
  298. package/dist/FormatFile-D-UIdDqE.js +156 -0
  299. package/dist/FormatRelativeDateTime/index.cjs +8 -0
  300. package/dist/FormatRelativeDateTime/index.mjs +2 -0
  301. package/dist/{FormatRelativeDateTime/index.js → FormatRelativeDateTime-COgItrYT.js} +5 -11
  302. package/dist/FormatRelativeDateTime-DTnQraIq.js +64 -0
  303. package/dist/FormatTime/index.cjs +8 -0
  304. package/dist/FormatTime/index.mjs +2 -0
  305. package/dist/FormatTime-BGr7_DaA.js +28 -0
  306. package/dist/{FormatTime/index.js → FormatTime-CfcVslez.js} +1 -7
  307. package/dist/Gallery/index.cjs +40 -0
  308. package/dist/Gallery/index.mjs +34 -0
  309. package/dist/Gallery-BMpC_ohB.js +66 -0
  310. package/dist/Gallery-DXXQxrHV.js +68 -0
  311. package/dist/Glimmer/index.cjs +13 -0
  312. package/dist/Glimmer/index.mjs +6 -0
  313. package/dist/Glimmer-Cgcy2Ruw.js +72 -0
  314. package/dist/Glimmer-Dz1E9Bo5.js +69 -0
  315. package/dist/Grid/InternalGridCell/index.cjs +10 -0
  316. package/dist/Grid/InternalGridCell/index.mjs +3 -0
  317. package/dist/Grid/index.cjs +13 -0
  318. package/dist/Grid/index.mjs +6 -0
  319. package/dist/Grid-2KPGnpZI.js +37 -0
  320. package/dist/Grid-ClBkskz-.js +34 -0
  321. package/dist/Heading/index.cjs +12 -0
  322. package/dist/Heading/index.mjs +6 -0
  323. package/dist/Heading-CL3UujY7.js +49 -0
  324. package/dist/{Heading-1e8e4bd3.js → Heading-suKDLmO4.js} +3 -7
  325. package/dist/Icon/index.cjs +9 -0
  326. package/dist/Icon/index.mjs +3 -0
  327. package/dist/Icon-B9XNdA1T.js +36 -0
  328. package/dist/Icon-CoHJokXb.js +34 -0
  329. package/dist/InlineLabel/index.cjs +11 -0
  330. package/dist/InlineLabel/index.mjs +5 -0
  331. package/dist/InlineLabel-BPjH1ASc.js +23 -0
  332. package/dist/InlineLabel-x3msDD5R.js +21 -0
  333. package/dist/InputAvatar/index.cjs +26 -0
  334. package/dist/InputAvatar/index.mjs +20 -0
  335. package/dist/InputAvatar-DcNJEpM3.js +52 -0
  336. package/dist/InputAvatar-Dp3cCHai.js +50 -0
  337. package/dist/InputDate/index.cjs +33 -0
  338. package/dist/InputDate/index.mjs +27 -0
  339. package/dist/InputDate-Brwb3gue.js +31 -0
  340. package/dist/InputDate-D5pZraRN.js +33 -0
  341. package/dist/InputEmail/index.cjs +24 -0
  342. package/dist/InputEmail/index.mjs +17 -0
  343. package/dist/InputEmail-DkvNQj63.js +23 -0
  344. package/dist/InputEmail-nxOzDFb8.js +20 -0
  345. package/dist/InputFile/index.cjs +23 -0
  346. package/dist/InputFile/index.mjs +16 -0
  347. package/dist/InputFile-BBOdV6FH.js +2794 -0
  348. package/dist/InputFile-l-Zdbe8r.js +2797 -0
  349. package/dist/InputGroup/index.cjs +10 -0
  350. package/dist/InputGroup/index.mjs +4 -0
  351. package/dist/{InputGroup-8d4fd4eb.js → InputGroup-Bljb97cw.js} +5 -10
  352. package/dist/InputGroup-CCJ2rycA.js +26 -0
  353. package/dist/InputNumber/index.cjs +23 -0
  354. package/dist/InputNumber/index.mjs +17 -0
  355. package/dist/{InputNumber-d451b52e.js → InputNumber-B3-6b6mT.js} +2 -6
  356. package/dist/InputNumber-D2jOwtOi.js +56 -0
  357. package/dist/InputPassword/index.cjs +23 -0
  358. package/dist/InputPassword/index.mjs +17 -0
  359. package/dist/InputPassword-BwPfewHd.js +19 -0
  360. package/dist/InputPassword-mWbDB3Oh.js +21 -0
  361. package/dist/InputPhoneNumber/index.cjs +23 -0
  362. package/dist/InputPhoneNumber/index.mjs +17 -0
  363. package/dist/{InputPhoneNumber/index.js → InputPhoneNumber-CrkVlyUE.js} +8 -25
  364. package/dist/InputPhoneNumber-ynZiTe9j.js +97 -0
  365. package/dist/InputText/index.cjs +24 -0
  366. package/dist/InputText/index.mjs +18 -0
  367. package/dist/InputText-CgykvJl2.js +96 -0
  368. package/dist/{InputText-55b6cb65.js → InputText-D1KkzO4T.js} +2 -6
  369. package/dist/InputTime/index.cjs +28 -0
  370. package/dist/InputTime/index.mjs +22 -0
  371. package/dist/InputTime-CVHCWh2x.js +187 -0
  372. package/dist/{InputTime/index.js → InputTime-Ce0H2RWH.js} +5 -25
  373. package/dist/InputValidation/index.cjs +15 -0
  374. package/dist/InputValidation/index.mjs +9 -0
  375. package/dist/InputValidation-BmgvSw0e.js +23 -0
  376. package/dist/InputValidation-DIwnbDDv.js +25 -0
  377. package/dist/InternalChipDismissible-BoAPXU91.js +158 -0
  378. package/dist/InternalChipDismissible-Dj-XvjT4.js +163 -0
  379. package/dist/InternalGridCell-CBv95C-G.js +37 -0
  380. package/dist/InternalGridCell-DFrhM8oX.js +40 -0
  381. package/dist/LightBox/index.cjs +25 -0
  382. package/dist/LightBox/index.mjs +19 -0
  383. package/dist/LightBox-DLJk1m24.js +109 -0
  384. package/dist/LightBox-oRvBzCVE.js +111 -0
  385. package/dist/Link/index.cjs +8 -0
  386. package/dist/Link/index.mjs +2 -0
  387. package/dist/Link-Bnzn51lp.js +9 -0
  388. package/dist/Link-CTWzdpyV.js +7 -0
  389. package/dist/List/index.cjs +28 -0
  390. package/dist/List/index.d.ts +1 -1
  391. package/dist/List/index.mjs +21 -0
  392. package/dist/List-BLRtWdVA.js +196 -0
  393. package/dist/List-C6AG4_dM.js +193 -0
  394. package/dist/Markdown/index.cjs +17 -0
  395. package/dist/Markdown/index.mjs +11 -0
  396. package/dist/Markdown-B2B4q1R4.js +57 -0
  397. package/dist/Markdown-BqNLA1UK.js +55 -0
  398. package/dist/Menu/{index.js → index.cjs} +5 -7
  399. package/dist/Menu/index.mjs +13 -0
  400. package/dist/Menu-BXvyYPow.js +132 -0
  401. package/dist/Menu-DWqTLjQu.js +134 -0
  402. package/dist/Modal/index.cjs +23 -0
  403. package/dist/Modal/index.mjs +17 -0
  404. package/dist/Modal-BsCYxzQV.js +65 -0
  405. package/dist/Modal-COtt6AGz.js +63 -0
  406. package/dist/MultiSelect/index.cjs +17 -0
  407. package/dist/MultiSelect/index.mjs +11 -0
  408. package/dist/MultiSelect-ByY6NzAS.js +169 -0
  409. package/dist/{MultiSelect/index.js → MultiSelect-D_-_TiTD.js} +16 -27
  410. package/dist/Option-BmWN4Bgv.js +15 -0
  411. package/dist/Option-DkWd2dv6.js +12 -0
  412. package/dist/Page/index.cjs +28 -0
  413. package/dist/Page/index.mjs +22 -0
  414. package/dist/Page-CI4G1pxg.js +61 -0
  415. package/dist/Page-DdD5O2fP.js +59 -0
  416. package/dist/Popover/index.cjs +18 -0
  417. package/dist/Popover/index.mjs +12 -0
  418. package/dist/Popover-D2Lc46rN.js +49 -0
  419. package/dist/Popover-MtwM2-M4.js +47 -0
  420. package/dist/ProgressBar/index.cjs +10 -0
  421. package/dist/ProgressBar/index.mjs +4 -0
  422. package/dist/ProgressBar-D2wik11q.js +38 -0
  423. package/dist/ProgressBar-DjFTRxLD.js +36 -0
  424. package/dist/RadioGroup/index.cjs +13 -0
  425. package/dist/RadioGroup/index.mjs +6 -0
  426. package/dist/RadioGroup-CL8tcJwY.js +42 -0
  427. package/dist/RadioGroup-CvoMZUNQ.js +39 -0
  428. package/dist/RecurringSelect/components/index.cjs +16 -0
  429. package/dist/RecurringSelect/components/index.mjs +7 -0
  430. package/dist/RecurringSelect/index.cjs +37 -0
  431. package/dist/RecurringSelect/index.mjs +23 -0
  432. package/dist/RecurringSelect-BQuw43z9.js +74 -0
  433. package/dist/RecurringSelect-DLFrS379.js +76 -0
  434. package/dist/Select/index.cjs +24 -0
  435. package/dist/Select/index.mjs +17 -0
  436. package/dist/Spinner/index.cjs +10 -0
  437. package/dist/Spinner/index.mjs +4 -0
  438. package/dist/Spinner-BOhyUAA_.js +17 -0
  439. package/dist/Spinner-DT15aa_r.js +19 -0
  440. package/dist/StatusIndicator/index.cjs +9 -0
  441. package/dist/StatusIndicator/index.mjs +3 -0
  442. package/dist/StatusIndicator-DMcPLJ2i.js +14 -0
  443. package/dist/StatusIndicator-DcXKG260.js +12 -0
  444. package/dist/StatusLabel/index.cjs +13 -0
  445. package/dist/StatusLabel/index.mjs +7 -0
  446. package/dist/StatusLabel-8RoVevu0.js +21 -0
  447. package/dist/StatusLabel-BJsnaMk6.js +19 -0
  448. package/dist/Switch/index.cjs +11 -0
  449. package/dist/Switch/index.mjs +5 -0
  450. package/dist/Switch-CQA6xnNA.js +49 -0
  451. package/dist/Switch-CWis2Tw3.js +51 -0
  452. package/dist/Table/index.cjs +18 -0
  453. package/dist/Table/index.mjs +5 -0
  454. package/dist/Tabs/index.cjs +12 -0
  455. package/dist/Tabs/index.mjs +5 -0
  456. package/dist/Tabs-D8_NCGQa.js +70 -0
  457. package/dist/Tabs-DsTn5FwP.js +73 -0
  458. package/dist/Text/index.cjs +11 -0
  459. package/dist/Text/index.mjs +5 -0
  460. package/dist/{Text-259af966.js → Text-D9gsHxbp.js} +2 -6
  461. package/dist/Text-DEviM1Tv.js +25 -0
  462. package/dist/Toast/index.cjs +17 -0
  463. package/dist/Toast/index.mjs +11 -0
  464. package/dist/Tooltip/{index.js → index.cjs} +2 -4
  465. package/dist/Tooltip/index.mjs +8 -0
  466. package/dist/Tooltip-DG1mcZlX.js +104 -0
  467. package/dist/{Tooltip-ef3d6ef4.js → Tooltip-DWAVu0yQ.js} +10 -16
  468. package/dist/Typography/index.cjs +10 -0
  469. package/dist/Typography/index.mjs +4 -0
  470. package/dist/Typography-Dx8KtnBw.js +57 -0
  471. package/dist/Typography-G8pA_xwj.js +55 -0
  472. package/dist/_baseAssignValue-BDfrxHwl.js +29 -0
  473. package/dist/_baseAssignValue-Cq-EPFBb.js +31 -0
  474. package/dist/_baseEach-C5AdInAP.js +1069 -0
  475. package/dist/_baseEach-fQjYIaCA.js +1073 -0
  476. package/dist/_commonjsHelpers-BFTU3MAI.js +7 -0
  477. package/dist/_commonjsHelpers-BJu3ubxk.js +10 -0
  478. package/dist/_defineProperty-DVTdBF7D.js +1326 -0
  479. package/dist/_defineProperty-DYWOWIJv.js +1306 -0
  480. package/dist/_getTag-CHBhnZgu.js +733 -0
  481. package/dist/_getTag-DYzEQmpZ.js +718 -0
  482. package/dist/_setToString-Cjq7b1P9.js +230 -0
  483. package/dist/_setToString-F-wwuS_Y.js +234 -0
  484. package/dist/debounce-B-pQrPa0.js +331 -0
  485. package/dist/debounce-asENWBkf.js +329 -0
  486. package/dist/getAtlantisConfig-6FPWID0P.js +11 -0
  487. package/dist/helpers-5vvADJkh.js +15 -0
  488. package/dist/helpers-CFWATKJI.js +36 -0
  489. package/dist/index.cjs +274 -0
  490. package/dist/index.d.mts +73 -0
  491. package/dist/index.d.ts +73 -0
  492. package/dist/index.mjs +164 -0
  493. package/dist/isObjectLike-91E0YOes.js +190 -0
  494. package/dist/isObjectLike-CsWGWxp9.js +197 -0
  495. package/dist/isSymbol-BEvcpX3s.js +33 -0
  496. package/dist/isSymbol-CqL-NQwG.js +35 -0
  497. package/dist/noop-DXH2P2oE.js +26 -0
  498. package/dist/noop-D_wzwwIq.js +24 -0
  499. package/dist/showToast-CSU2xysR.js +102 -0
  500. package/dist/showToast-lrVl7hOm.js +104 -0
  501. package/dist/style-inject.es-tgCJW-Cu.js +28 -0
  502. package/dist/tslib.es6-Df1SgIEn.js +97 -0
  503. package/dist/tslib.es6-ld72nsZq.js +102 -0
  504. package/dist/useActiveLayout-BzQghohH.js +16 -0
  505. package/dist/useActiveLayout-DazMYwxf.js +14 -0
  506. package/dist/useBatchSelect-B7U15920.js +38 -0
  507. package/dist/useBatchSelect-DMD3JH4P.js +36 -0
  508. package/dist/useChildComponent-BUH0ttPi.js +17 -0
  509. package/dist/useChildComponent-D95jU7NM.js +15 -0
  510. package/dist/useResponsiveSizing-CMuS7Or1.js +46 -0
  511. package/dist/useResponsiveSizing-DRjeJos_.js +44 -0
  512. package/dist/useScrollToActive-BB-8euJF.js +554 -0
  513. package/dist/useScrollToActive-KSEZO66J.js +548 -0
  514. package/package.json +382 -9
  515. package/{rollup.config.js → rollup.config.mjs} +27 -18
  516. package/dist/AnimatedSwitcher/index.js +0 -13
  517. package/dist/Avatar/index.js +0 -15
  518. package/dist/Avatar-76a799fa.js +0 -78
  519. package/dist/Banner/index.js +0 -110
  520. package/dist/Button/index.js +0 -16
  521. package/dist/Button-b73a5e01.js +0 -57
  522. package/dist/ButtonDismiss/index.js +0 -17
  523. package/dist/ButtonDismiss-350af163.js +0 -14
  524. package/dist/Card/index.js +0 -24
  525. package/dist/Checkbox/index.js +0 -18
  526. package/dist/Checkbox-787e2e47.js +0 -63
  527. package/dist/Chip/index.js +0 -41
  528. package/dist/Chip-3d1bfddc.js +0 -89
  529. package/dist/Chips/index.js +0 -524
  530. package/dist/Combobox/index.js +0 -40
  531. package/dist/Combobox-a24c8241.js +0 -479
  532. package/dist/ConfirmationModal/index.js +0 -31
  533. package/dist/Content/index.js +0 -12
  534. package/dist/Content-e3f7b6fc.js +0 -24
  535. package/dist/DataDump/index.js +0 -37
  536. package/dist/DataList/index.js +0 -1335
  537. package/dist/DataTable/index.js +0 -301
  538. package/dist/DatePicker/index.js +0 -20
  539. package/dist/DatePicker-64c5ab1a.js +0 -134
  540. package/dist/DescriptionList/index.js +0 -24
  541. package/dist/Disclosure/index.js +0 -46
  542. package/dist/Drawer/index.js +0 -49
  543. package/dist/Emphasis/index.js +0 -13
  544. package/dist/Emphasis-bda56d3b.js +0 -19
  545. package/dist/FeatureSwitch/index.js +0 -70
  546. package/dist/Flex/index.js +0 -12
  547. package/dist/FormField/index.js +0 -24
  548. package/dist/FormField-6ff183f8.js +0 -253
  549. package/dist/FormatEmail/index.js +0 -23
  550. package/dist/FormatFile/index.js +0 -36
  551. package/dist/FormatFile-f036902d.js +0 -162
  552. package/dist/Gallery/index.js +0 -99
  553. package/dist/Glimmer/index.js +0 -15
  554. package/dist/Glimmer-84dee1ed.js +0 -77
  555. package/dist/Grid/index.js +0 -76
  556. package/dist/Heading/index.js +0 -14
  557. package/dist/Icon/index.js +0 -11
  558. package/dist/Icon-405a216c.js +0 -40
  559. package/dist/InlineLabel/index.js +0 -13
  560. package/dist/InlineLabel-a6557829.js +0 -28
  561. package/dist/InputAvatar/index.js +0 -70
  562. package/dist/InputDate/index.js +0 -57
  563. package/dist/InputEmail/index.js +0 -43
  564. package/dist/InputFile/index.js +0 -25
  565. package/dist/InputFile-bb945071.js +0 -190
  566. package/dist/InputGroup/index.js +0 -12
  567. package/dist/InputNumber/index.js +0 -25
  568. package/dist/InputPassword/index.js +0 -41
  569. package/dist/InputText/index.js +0 -26
  570. package/dist/InputValidation/index.js +0 -17
  571. package/dist/InputValidation-05e839fa.js +0 -29
  572. package/dist/LightBox/index.js +0 -24
  573. package/dist/LightBox-a89d8863.js +0 -117
  574. package/dist/Link/index.js +0 -15
  575. package/dist/List/index.js +0 -93
  576. package/dist/Markdown/index.js +0 -19
  577. package/dist/Markdown-f7c55304.js +0 -62
  578. package/dist/Menu-083fc4c4.js +0 -139
  579. package/dist/Modal/index.js +0 -25
  580. package/dist/Modal-c336cac6.js +0 -71
  581. package/dist/Option-3c4d377e.js +0 -19
  582. package/dist/Page/index.js +0 -78
  583. package/dist/Popover/index.js +0 -61
  584. package/dist/ProgressBar/index.js +0 -12
  585. package/dist/ProgressBar-b68edc8f.js +0 -43
  586. package/dist/RadioGroup/index.js +0 -15
  587. package/dist/RadioGroup-17b67ade.js +0 -46
  588. package/dist/RecurringSelect/index.js +0 -227
  589. package/dist/Select/index.js +0 -26
  590. package/dist/Spinner/index.js +0 -12
  591. package/dist/Spinner-9d8fc7ff.js +0 -24
  592. package/dist/StatusIndicator/index.js +0 -11
  593. package/dist/StatusIndicator-b179d06e.js +0 -18
  594. package/dist/StatusLabel/index.js +0 -29
  595. package/dist/Switch/index.js +0 -13
  596. package/dist/Switch-7d4aa7c3.js +0 -56
  597. package/dist/Table/index.js +0 -66
  598. package/dist/Tabs/index.js +0 -80
  599. package/dist/Text/index.js +0 -13
  600. package/dist/Toast/index.js +0 -111
  601. package/dist/Typography/index.js +0 -12
  602. package/dist/Typography-c45bf216.js +0 -62
  603. package/dist/tslib.es6-754e2961.js +0 -46
  604. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
  605. /package/dist/{getAtlantisConfig-0f3e8af2.js → getAtlantisConfig-mcMVqf6m.js} +0 -0
  606. /package/dist/{style-inject.es-9d2f5f4e.js → style-inject.es-XZHJH68X.js} +0 -0
@@ -0,0 +1,2797 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-ld72nsZq.js');
4
+ var React = require('react');
5
+ var classnames = require('classnames');
6
+ var _commonjsHelpers = require('./_commonjsHelpers-BJu3ubxk.js');
7
+ var axios = require('axios');
8
+ var styleInject_es = require('./style-inject.es-XZHJH68X.js');
9
+ var InputValidation = require('./InputValidation-DIwnbDDv.js');
10
+ var Button = require('./Button-D3mW3Hcg.js');
11
+ var Content = require('./Content-B8Od1cqS.js');
12
+ var Typography = require('./Typography-Dx8KtnBw.js');
13
+
14
+ var propTypes = {exports: {}};
15
+
16
+ var reactIs = {exports: {}};
17
+
18
+ var reactIs_production_min = {};
19
+
20
+ /** @license React v16.13.1
21
+ * react-is.production.min.js
22
+ *
23
+ * Copyright (c) Facebook, Inc. and its affiliates.
24
+ *
25
+ * This source code is licensed under the MIT license found in the
26
+ * LICENSE file in the root directory of this source tree.
27
+ */
28
+
29
+ var hasRequiredReactIs_production_min;
30
+
31
+ function requireReactIs_production_min () {
32
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
33
+ hasRequiredReactIs_production_min = 1;
34
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
35
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
36
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
37
+ reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
38
+ reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
39
+ reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
40
+ return reactIs_production_min;
41
+ }
42
+
43
+ var reactIs_development = {};
44
+
45
+ /** @license React v16.13.1
46
+ * react-is.development.js
47
+ *
48
+ * Copyright (c) Facebook, Inc. and its affiliates.
49
+ *
50
+ * This source code is licensed under the MIT license found in the
51
+ * LICENSE file in the root directory of this source tree.
52
+ */
53
+
54
+ var hasRequiredReactIs_development;
55
+
56
+ function requireReactIs_development () {
57
+ if (hasRequiredReactIs_development) return reactIs_development;
58
+ hasRequiredReactIs_development = 1;
59
+
60
+
61
+
62
+ if (process.env.NODE_ENV !== "production") {
63
+ (function() {
64
+
65
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
66
+ // nor polyfill, then a plain number is used for performance.
67
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
68
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
69
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
70
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
71
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
72
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
73
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
74
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
75
+ // (unstable) APIs that have been removed. Can we remove the symbols?
76
+
77
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
78
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
79
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
80
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
81
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
82
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
83
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
84
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
85
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
86
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
87
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
88
+
89
+ function isValidElementType(type) {
90
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
91
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
92
+ }
93
+
94
+ function typeOf(object) {
95
+ if (typeof object === 'object' && object !== null) {
96
+ var $$typeof = object.$$typeof;
97
+
98
+ switch ($$typeof) {
99
+ case REACT_ELEMENT_TYPE:
100
+ var type = object.type;
101
+
102
+ switch (type) {
103
+ case REACT_ASYNC_MODE_TYPE:
104
+ case REACT_CONCURRENT_MODE_TYPE:
105
+ case REACT_FRAGMENT_TYPE:
106
+ case REACT_PROFILER_TYPE:
107
+ case REACT_STRICT_MODE_TYPE:
108
+ case REACT_SUSPENSE_TYPE:
109
+ return type;
110
+
111
+ default:
112
+ var $$typeofType = type && type.$$typeof;
113
+
114
+ switch ($$typeofType) {
115
+ case REACT_CONTEXT_TYPE:
116
+ case REACT_FORWARD_REF_TYPE:
117
+ case REACT_LAZY_TYPE:
118
+ case REACT_MEMO_TYPE:
119
+ case REACT_PROVIDER_TYPE:
120
+ return $$typeofType;
121
+
122
+ default:
123
+ return $$typeof;
124
+ }
125
+
126
+ }
127
+
128
+ case REACT_PORTAL_TYPE:
129
+ return $$typeof;
130
+ }
131
+ }
132
+
133
+ return undefined;
134
+ } // AsyncMode is deprecated along with isAsyncMode
135
+
136
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
137
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
138
+ var ContextConsumer = REACT_CONTEXT_TYPE;
139
+ var ContextProvider = REACT_PROVIDER_TYPE;
140
+ var Element = REACT_ELEMENT_TYPE;
141
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
142
+ var Fragment = REACT_FRAGMENT_TYPE;
143
+ var Lazy = REACT_LAZY_TYPE;
144
+ var Memo = REACT_MEMO_TYPE;
145
+ var Portal = REACT_PORTAL_TYPE;
146
+ var Profiler = REACT_PROFILER_TYPE;
147
+ var StrictMode = REACT_STRICT_MODE_TYPE;
148
+ var Suspense = REACT_SUSPENSE_TYPE;
149
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
150
+
151
+ function isAsyncMode(object) {
152
+ {
153
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
154
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
155
+
156
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
157
+ }
158
+ }
159
+
160
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
161
+ }
162
+ function isConcurrentMode(object) {
163
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
164
+ }
165
+ function isContextConsumer(object) {
166
+ return typeOf(object) === REACT_CONTEXT_TYPE;
167
+ }
168
+ function isContextProvider(object) {
169
+ return typeOf(object) === REACT_PROVIDER_TYPE;
170
+ }
171
+ function isElement(object) {
172
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
173
+ }
174
+ function isForwardRef(object) {
175
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
176
+ }
177
+ function isFragment(object) {
178
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
179
+ }
180
+ function isLazy(object) {
181
+ return typeOf(object) === REACT_LAZY_TYPE;
182
+ }
183
+ function isMemo(object) {
184
+ return typeOf(object) === REACT_MEMO_TYPE;
185
+ }
186
+ function isPortal(object) {
187
+ return typeOf(object) === REACT_PORTAL_TYPE;
188
+ }
189
+ function isProfiler(object) {
190
+ return typeOf(object) === REACT_PROFILER_TYPE;
191
+ }
192
+ function isStrictMode(object) {
193
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
194
+ }
195
+ function isSuspense(object) {
196
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
197
+ }
198
+
199
+ reactIs_development.AsyncMode = AsyncMode;
200
+ reactIs_development.ConcurrentMode = ConcurrentMode;
201
+ reactIs_development.ContextConsumer = ContextConsumer;
202
+ reactIs_development.ContextProvider = ContextProvider;
203
+ reactIs_development.Element = Element;
204
+ reactIs_development.ForwardRef = ForwardRef;
205
+ reactIs_development.Fragment = Fragment;
206
+ reactIs_development.Lazy = Lazy;
207
+ reactIs_development.Memo = Memo;
208
+ reactIs_development.Portal = Portal;
209
+ reactIs_development.Profiler = Profiler;
210
+ reactIs_development.StrictMode = StrictMode;
211
+ reactIs_development.Suspense = Suspense;
212
+ reactIs_development.isAsyncMode = isAsyncMode;
213
+ reactIs_development.isConcurrentMode = isConcurrentMode;
214
+ reactIs_development.isContextConsumer = isContextConsumer;
215
+ reactIs_development.isContextProvider = isContextProvider;
216
+ reactIs_development.isElement = isElement;
217
+ reactIs_development.isForwardRef = isForwardRef;
218
+ reactIs_development.isFragment = isFragment;
219
+ reactIs_development.isLazy = isLazy;
220
+ reactIs_development.isMemo = isMemo;
221
+ reactIs_development.isPortal = isPortal;
222
+ reactIs_development.isProfiler = isProfiler;
223
+ reactIs_development.isStrictMode = isStrictMode;
224
+ reactIs_development.isSuspense = isSuspense;
225
+ reactIs_development.isValidElementType = isValidElementType;
226
+ reactIs_development.typeOf = typeOf;
227
+ })();
228
+ }
229
+ return reactIs_development;
230
+ }
231
+
232
+ var hasRequiredReactIs;
233
+
234
+ function requireReactIs () {
235
+ if (hasRequiredReactIs) return reactIs.exports;
236
+ hasRequiredReactIs = 1;
237
+
238
+ if (process.env.NODE_ENV === 'production') {
239
+ reactIs.exports = requireReactIs_production_min();
240
+ } else {
241
+ reactIs.exports = requireReactIs_development();
242
+ }
243
+ return reactIs.exports;
244
+ }
245
+
246
+ /*
247
+ object-assign
248
+ (c) Sindre Sorhus
249
+ @license MIT
250
+ */
251
+
252
+ var objectAssign;
253
+ var hasRequiredObjectAssign;
254
+
255
+ function requireObjectAssign () {
256
+ if (hasRequiredObjectAssign) return objectAssign;
257
+ hasRequiredObjectAssign = 1;
258
+ /* eslint-disable no-unused-vars */
259
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
260
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
261
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
262
+
263
+ function toObject(val) {
264
+ if (val === null || val === undefined) {
265
+ throw new TypeError('Object.assign cannot be called with null or undefined');
266
+ }
267
+
268
+ return Object(val);
269
+ }
270
+
271
+ function shouldUseNative() {
272
+ try {
273
+ if (!Object.assign) {
274
+ return false;
275
+ }
276
+
277
+ // Detect buggy property enumeration order in older V8 versions.
278
+
279
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
280
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
281
+ test1[5] = 'de';
282
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
283
+ return false;
284
+ }
285
+
286
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
287
+ var test2 = {};
288
+ for (var i = 0; i < 10; i++) {
289
+ test2['_' + String.fromCharCode(i)] = i;
290
+ }
291
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
292
+ return test2[n];
293
+ });
294
+ if (order2.join('') !== '0123456789') {
295
+ return false;
296
+ }
297
+
298
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
299
+ var test3 = {};
300
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
301
+ test3[letter] = letter;
302
+ });
303
+ if (Object.keys(Object.assign({}, test3)).join('') !==
304
+ 'abcdefghijklmnopqrst') {
305
+ return false;
306
+ }
307
+
308
+ return true;
309
+ } catch (err) {
310
+ // We don't expect any of the above to throw, but better to be safe.
311
+ return false;
312
+ }
313
+ }
314
+
315
+ objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
316
+ var from;
317
+ var to = toObject(target);
318
+ var symbols;
319
+
320
+ for (var s = 1; s < arguments.length; s++) {
321
+ from = Object(arguments[s]);
322
+
323
+ for (var key in from) {
324
+ if (hasOwnProperty.call(from, key)) {
325
+ to[key] = from[key];
326
+ }
327
+ }
328
+
329
+ if (getOwnPropertySymbols) {
330
+ symbols = getOwnPropertySymbols(from);
331
+ for (var i = 0; i < symbols.length; i++) {
332
+ if (propIsEnumerable.call(from, symbols[i])) {
333
+ to[symbols[i]] = from[symbols[i]];
334
+ }
335
+ }
336
+ }
337
+ }
338
+
339
+ return to;
340
+ };
341
+ return objectAssign;
342
+ }
343
+
344
+ /**
345
+ * Copyright (c) 2013-present, Facebook, Inc.
346
+ *
347
+ * This source code is licensed under the MIT license found in the
348
+ * LICENSE file in the root directory of this source tree.
349
+ */
350
+
351
+ var ReactPropTypesSecret_1;
352
+ var hasRequiredReactPropTypesSecret;
353
+
354
+ function requireReactPropTypesSecret () {
355
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
356
+ hasRequiredReactPropTypesSecret = 1;
357
+
358
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
359
+
360
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
361
+ return ReactPropTypesSecret_1;
362
+ }
363
+
364
+ var has;
365
+ var hasRequiredHas;
366
+
367
+ function requireHas () {
368
+ if (hasRequiredHas) return has;
369
+ hasRequiredHas = 1;
370
+ has = Function.call.bind(Object.prototype.hasOwnProperty);
371
+ return has;
372
+ }
373
+
374
+ /**
375
+ * Copyright (c) 2013-present, Facebook, Inc.
376
+ *
377
+ * This source code is licensed under the MIT license found in the
378
+ * LICENSE file in the root directory of this source tree.
379
+ */
380
+
381
+ var checkPropTypes_1;
382
+ var hasRequiredCheckPropTypes;
383
+
384
+ function requireCheckPropTypes () {
385
+ if (hasRequiredCheckPropTypes) return checkPropTypes_1;
386
+ hasRequiredCheckPropTypes = 1;
387
+
388
+ var printWarning = function() {};
389
+
390
+ if (process.env.NODE_ENV !== 'production') {
391
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
392
+ var loggedTypeFailures = {};
393
+ var has = requireHas();
394
+
395
+ printWarning = function(text) {
396
+ var message = 'Warning: ' + text;
397
+ if (typeof console !== 'undefined') {
398
+ console.error(message);
399
+ }
400
+ try {
401
+ // --- Welcome to debugging React ---
402
+ // This error was thrown as a convenience so that you can use this stack
403
+ // to find the callsite that caused this warning to fire.
404
+ throw new Error(message);
405
+ } catch (x) { /**/ }
406
+ };
407
+ }
408
+
409
+ /**
410
+ * Assert that the values match with the type specs.
411
+ * Error messages are memorized and will only be shown once.
412
+ *
413
+ * @param {object} typeSpecs Map of name to a ReactPropType
414
+ * @param {object} values Runtime values that need to be type-checked
415
+ * @param {string} location e.g. "prop", "context", "child context"
416
+ * @param {string} componentName Name of the component for error messages.
417
+ * @param {?Function} getStack Returns the component stack.
418
+ * @private
419
+ */
420
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
421
+ if (process.env.NODE_ENV !== 'production') {
422
+ for (var typeSpecName in typeSpecs) {
423
+ if (has(typeSpecs, typeSpecName)) {
424
+ var error;
425
+ // Prop type validation may throw. In case they do, we don't want to
426
+ // fail the render phase where it didn't fail before. So we log it.
427
+ // After these have been cleaned up, we'll let them throw.
428
+ try {
429
+ // This is intentionally an invariant that gets caught. It's the same
430
+ // behavior as without this statement except with a better message.
431
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
432
+ var err = Error(
433
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
434
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
435
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
436
+ );
437
+ err.name = 'Invariant Violation';
438
+ throw err;
439
+ }
440
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
441
+ } catch (ex) {
442
+ error = ex;
443
+ }
444
+ if (error && !(error instanceof Error)) {
445
+ printWarning(
446
+ (componentName || 'React class') + ': type specification of ' +
447
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
448
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
449
+ 'You may have forgotten to pass an argument to the type checker ' +
450
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
451
+ 'shape all require an argument).'
452
+ );
453
+ }
454
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
455
+ // Only monitor this failure once because there tends to be a lot of the
456
+ // same error.
457
+ loggedTypeFailures[error.message] = true;
458
+
459
+ var stack = getStack ? getStack() : '';
460
+
461
+ printWarning(
462
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
463
+ );
464
+ }
465
+ }
466
+ }
467
+ }
468
+ }
469
+
470
+ /**
471
+ * Resets warning cache when testing.
472
+ *
473
+ * @private
474
+ */
475
+ checkPropTypes.resetWarningCache = function() {
476
+ if (process.env.NODE_ENV !== 'production') {
477
+ loggedTypeFailures = {};
478
+ }
479
+ };
480
+
481
+ checkPropTypes_1 = checkPropTypes;
482
+ return checkPropTypes_1;
483
+ }
484
+
485
+ /**
486
+ * Copyright (c) 2013-present, Facebook, Inc.
487
+ *
488
+ * This source code is licensed under the MIT license found in the
489
+ * LICENSE file in the root directory of this source tree.
490
+ */
491
+
492
+ var factoryWithTypeCheckers;
493
+ var hasRequiredFactoryWithTypeCheckers;
494
+
495
+ function requireFactoryWithTypeCheckers () {
496
+ if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
497
+ hasRequiredFactoryWithTypeCheckers = 1;
498
+
499
+ var ReactIs = requireReactIs();
500
+ var assign = requireObjectAssign();
501
+
502
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
503
+ var has = requireHas();
504
+ var checkPropTypes = requireCheckPropTypes();
505
+
506
+ var printWarning = function() {};
507
+
508
+ if (process.env.NODE_ENV !== 'production') {
509
+ printWarning = function(text) {
510
+ var message = 'Warning: ' + text;
511
+ if (typeof console !== 'undefined') {
512
+ console.error(message);
513
+ }
514
+ try {
515
+ // --- Welcome to debugging React ---
516
+ // This error was thrown as a convenience so that you can use this stack
517
+ // to find the callsite that caused this warning to fire.
518
+ throw new Error(message);
519
+ } catch (x) {}
520
+ };
521
+ }
522
+
523
+ function emptyFunctionThatReturnsNull() {
524
+ return null;
525
+ }
526
+
527
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
528
+ /* global Symbol */
529
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
530
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
531
+
532
+ /**
533
+ * Returns the iterator method function contained on the iterable object.
534
+ *
535
+ * Be sure to invoke the function with the iterable as context:
536
+ *
537
+ * var iteratorFn = getIteratorFn(myIterable);
538
+ * if (iteratorFn) {
539
+ * var iterator = iteratorFn.call(myIterable);
540
+ * ...
541
+ * }
542
+ *
543
+ * @param {?object} maybeIterable
544
+ * @return {?function}
545
+ */
546
+ function getIteratorFn(maybeIterable) {
547
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
548
+ if (typeof iteratorFn === 'function') {
549
+ return iteratorFn;
550
+ }
551
+ }
552
+
553
+ /**
554
+ * Collection of methods that allow declaration and validation of props that are
555
+ * supplied to React components. Example usage:
556
+ *
557
+ * var Props = require('ReactPropTypes');
558
+ * var MyArticle = React.createClass({
559
+ * propTypes: {
560
+ * // An optional string prop named "description".
561
+ * description: Props.string,
562
+ *
563
+ * // A required enum prop named "category".
564
+ * category: Props.oneOf(['News','Photos']).isRequired,
565
+ *
566
+ * // A prop named "dialog" that requires an instance of Dialog.
567
+ * dialog: Props.instanceOf(Dialog).isRequired
568
+ * },
569
+ * render: function() { ... }
570
+ * });
571
+ *
572
+ * A more formal specification of how these methods are used:
573
+ *
574
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
575
+ * decl := ReactPropTypes.{type}(.isRequired)?
576
+ *
577
+ * Each and every declaration produces a function with the same signature. This
578
+ * allows the creation of custom validation functions. For example:
579
+ *
580
+ * var MyLink = React.createClass({
581
+ * propTypes: {
582
+ * // An optional string or URI prop named "href".
583
+ * href: function(props, propName, componentName) {
584
+ * var propValue = props[propName];
585
+ * if (propValue != null && typeof propValue !== 'string' &&
586
+ * !(propValue instanceof URI)) {
587
+ * return new Error(
588
+ * 'Expected a string or an URI for ' + propName + ' in ' +
589
+ * componentName
590
+ * );
591
+ * }
592
+ * }
593
+ * },
594
+ * render: function() {...}
595
+ * });
596
+ *
597
+ * @internal
598
+ */
599
+
600
+ var ANONYMOUS = '<<anonymous>>';
601
+
602
+ // Important!
603
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
604
+ var ReactPropTypes = {
605
+ array: createPrimitiveTypeChecker('array'),
606
+ bigint: createPrimitiveTypeChecker('bigint'),
607
+ bool: createPrimitiveTypeChecker('boolean'),
608
+ func: createPrimitiveTypeChecker('function'),
609
+ number: createPrimitiveTypeChecker('number'),
610
+ object: createPrimitiveTypeChecker('object'),
611
+ string: createPrimitiveTypeChecker('string'),
612
+ symbol: createPrimitiveTypeChecker('symbol'),
613
+
614
+ any: createAnyTypeChecker(),
615
+ arrayOf: createArrayOfTypeChecker,
616
+ element: createElementTypeChecker(),
617
+ elementType: createElementTypeTypeChecker(),
618
+ instanceOf: createInstanceTypeChecker,
619
+ node: createNodeChecker(),
620
+ objectOf: createObjectOfTypeChecker,
621
+ oneOf: createEnumTypeChecker,
622
+ oneOfType: createUnionTypeChecker,
623
+ shape: createShapeTypeChecker,
624
+ exact: createStrictShapeTypeChecker,
625
+ };
626
+
627
+ /**
628
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
629
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
630
+ */
631
+ /*eslint-disable no-self-compare*/
632
+ function is(x, y) {
633
+ // SameValue algorithm
634
+ if (x === y) {
635
+ // Steps 1-5, 7-10
636
+ // Steps 6.b-6.e: +0 != -0
637
+ return x !== 0 || 1 / x === 1 / y;
638
+ } else {
639
+ // Step 6.a: NaN == NaN
640
+ return x !== x && y !== y;
641
+ }
642
+ }
643
+ /*eslint-enable no-self-compare*/
644
+
645
+ /**
646
+ * We use an Error-like object for backward compatibility as people may call
647
+ * PropTypes directly and inspect their output. However, we don't use real
648
+ * Errors anymore. We don't inspect their stack anyway, and creating them
649
+ * is prohibitively expensive if they are created too often, such as what
650
+ * happens in oneOfType() for any type before the one that matched.
651
+ */
652
+ function PropTypeError(message, data) {
653
+ this.message = message;
654
+ this.data = data && typeof data === 'object' ? data: {};
655
+ this.stack = '';
656
+ }
657
+ // Make `instanceof Error` still work for returned errors.
658
+ PropTypeError.prototype = Error.prototype;
659
+
660
+ function createChainableTypeChecker(validate) {
661
+ if (process.env.NODE_ENV !== 'production') {
662
+ var manualPropTypeCallCache = {};
663
+ var manualPropTypeWarningCount = 0;
664
+ }
665
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
666
+ componentName = componentName || ANONYMOUS;
667
+ propFullName = propFullName || propName;
668
+
669
+ if (secret !== ReactPropTypesSecret) {
670
+ if (throwOnDirectAccess) {
671
+ // New behavior only for users of `prop-types` package
672
+ var err = new Error(
673
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
674
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
675
+ 'Read more at http://fb.me/use-check-prop-types'
676
+ );
677
+ err.name = 'Invariant Violation';
678
+ throw err;
679
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
680
+ // Old behavior for people using React.PropTypes
681
+ var cacheKey = componentName + ':' + propName;
682
+ if (
683
+ !manualPropTypeCallCache[cacheKey] &&
684
+ // Avoid spamming the console because they are often not actionable except for lib authors
685
+ manualPropTypeWarningCount < 3
686
+ ) {
687
+ printWarning(
688
+ 'You are manually calling a React.PropTypes validation ' +
689
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
690
+ 'and will throw in the standalone `prop-types` package. ' +
691
+ 'You may be seeing this warning due to a third-party PropTypes ' +
692
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
693
+ );
694
+ manualPropTypeCallCache[cacheKey] = true;
695
+ manualPropTypeWarningCount++;
696
+ }
697
+ }
698
+ }
699
+ if (props[propName] == null) {
700
+ if (isRequired) {
701
+ if (props[propName] === null) {
702
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
703
+ }
704
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
705
+ }
706
+ return null;
707
+ } else {
708
+ return validate(props, propName, componentName, location, propFullName);
709
+ }
710
+ }
711
+
712
+ var chainedCheckType = checkType.bind(null, false);
713
+ chainedCheckType.isRequired = checkType.bind(null, true);
714
+
715
+ return chainedCheckType;
716
+ }
717
+
718
+ function createPrimitiveTypeChecker(expectedType) {
719
+ function validate(props, propName, componentName, location, propFullName, secret) {
720
+ var propValue = props[propName];
721
+ var propType = getPropType(propValue);
722
+ if (propType !== expectedType) {
723
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
724
+ // check, but we can offer a more precise error message here rather than
725
+ // 'of type `object`'.
726
+ var preciseType = getPreciseType(propValue);
727
+
728
+ return new PropTypeError(
729
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
730
+ {expectedType: expectedType}
731
+ );
732
+ }
733
+ return null;
734
+ }
735
+ return createChainableTypeChecker(validate);
736
+ }
737
+
738
+ function createAnyTypeChecker() {
739
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
740
+ }
741
+
742
+ function createArrayOfTypeChecker(typeChecker) {
743
+ function validate(props, propName, componentName, location, propFullName) {
744
+ if (typeof typeChecker !== 'function') {
745
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
746
+ }
747
+ var propValue = props[propName];
748
+ if (!Array.isArray(propValue)) {
749
+ var propType = getPropType(propValue);
750
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
751
+ }
752
+ for (var i = 0; i < propValue.length; i++) {
753
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
754
+ if (error instanceof Error) {
755
+ return error;
756
+ }
757
+ }
758
+ return null;
759
+ }
760
+ return createChainableTypeChecker(validate);
761
+ }
762
+
763
+ function createElementTypeChecker() {
764
+ function validate(props, propName, componentName, location, propFullName) {
765
+ var propValue = props[propName];
766
+ if (!isValidElement(propValue)) {
767
+ var propType = getPropType(propValue);
768
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
769
+ }
770
+ return null;
771
+ }
772
+ return createChainableTypeChecker(validate);
773
+ }
774
+
775
+ function createElementTypeTypeChecker() {
776
+ function validate(props, propName, componentName, location, propFullName) {
777
+ var propValue = props[propName];
778
+ if (!ReactIs.isValidElementType(propValue)) {
779
+ var propType = getPropType(propValue);
780
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
781
+ }
782
+ return null;
783
+ }
784
+ return createChainableTypeChecker(validate);
785
+ }
786
+
787
+ function createInstanceTypeChecker(expectedClass) {
788
+ function validate(props, propName, componentName, location, propFullName) {
789
+ if (!(props[propName] instanceof expectedClass)) {
790
+ var expectedClassName = expectedClass.name || ANONYMOUS;
791
+ var actualClassName = getClassName(props[propName]);
792
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
793
+ }
794
+ return null;
795
+ }
796
+ return createChainableTypeChecker(validate);
797
+ }
798
+
799
+ function createEnumTypeChecker(expectedValues) {
800
+ if (!Array.isArray(expectedValues)) {
801
+ if (process.env.NODE_ENV !== 'production') {
802
+ if (arguments.length > 1) {
803
+ printWarning(
804
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
805
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
806
+ );
807
+ } else {
808
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
809
+ }
810
+ }
811
+ return emptyFunctionThatReturnsNull;
812
+ }
813
+
814
+ function validate(props, propName, componentName, location, propFullName) {
815
+ var propValue = props[propName];
816
+ for (var i = 0; i < expectedValues.length; i++) {
817
+ if (is(propValue, expectedValues[i])) {
818
+ return null;
819
+ }
820
+ }
821
+
822
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
823
+ var type = getPreciseType(value);
824
+ if (type === 'symbol') {
825
+ return String(value);
826
+ }
827
+ return value;
828
+ });
829
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
830
+ }
831
+ return createChainableTypeChecker(validate);
832
+ }
833
+
834
+ function createObjectOfTypeChecker(typeChecker) {
835
+ function validate(props, propName, componentName, location, propFullName) {
836
+ if (typeof typeChecker !== 'function') {
837
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
838
+ }
839
+ var propValue = props[propName];
840
+ var propType = getPropType(propValue);
841
+ if (propType !== 'object') {
842
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
843
+ }
844
+ for (var key in propValue) {
845
+ if (has(propValue, key)) {
846
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
847
+ if (error instanceof Error) {
848
+ return error;
849
+ }
850
+ }
851
+ }
852
+ return null;
853
+ }
854
+ return createChainableTypeChecker(validate);
855
+ }
856
+
857
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
858
+ if (!Array.isArray(arrayOfTypeCheckers)) {
859
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
860
+ return emptyFunctionThatReturnsNull;
861
+ }
862
+
863
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
864
+ var checker = arrayOfTypeCheckers[i];
865
+ if (typeof checker !== 'function') {
866
+ printWarning(
867
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
868
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
869
+ );
870
+ return emptyFunctionThatReturnsNull;
871
+ }
872
+ }
873
+
874
+ function validate(props, propName, componentName, location, propFullName) {
875
+ var expectedTypes = [];
876
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
877
+ var checker = arrayOfTypeCheckers[i];
878
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
879
+ if (checkerResult == null) {
880
+ return null;
881
+ }
882
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
883
+ expectedTypes.push(checkerResult.data.expectedType);
884
+ }
885
+ }
886
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
887
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
888
+ }
889
+ return createChainableTypeChecker(validate);
890
+ }
891
+
892
+ function createNodeChecker() {
893
+ function validate(props, propName, componentName, location, propFullName) {
894
+ if (!isNode(props[propName])) {
895
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
896
+ }
897
+ return null;
898
+ }
899
+ return createChainableTypeChecker(validate);
900
+ }
901
+
902
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
903
+ return new PropTypeError(
904
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
905
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
906
+ );
907
+ }
908
+
909
+ function createShapeTypeChecker(shapeTypes) {
910
+ function validate(props, propName, componentName, location, propFullName) {
911
+ var propValue = props[propName];
912
+ var propType = getPropType(propValue);
913
+ if (propType !== 'object') {
914
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
915
+ }
916
+ for (var key in shapeTypes) {
917
+ var checker = shapeTypes[key];
918
+ if (typeof checker !== 'function') {
919
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
920
+ }
921
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
922
+ if (error) {
923
+ return error;
924
+ }
925
+ }
926
+ return null;
927
+ }
928
+ return createChainableTypeChecker(validate);
929
+ }
930
+
931
+ function createStrictShapeTypeChecker(shapeTypes) {
932
+ function validate(props, propName, componentName, location, propFullName) {
933
+ var propValue = props[propName];
934
+ var propType = getPropType(propValue);
935
+ if (propType !== 'object') {
936
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
937
+ }
938
+ // We need to check all keys in case some are required but missing from props.
939
+ var allKeys = assign({}, props[propName], shapeTypes);
940
+ for (var key in allKeys) {
941
+ var checker = shapeTypes[key];
942
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
943
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
944
+ }
945
+ if (!checker) {
946
+ return new PropTypeError(
947
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
948
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
949
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
950
+ );
951
+ }
952
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
953
+ if (error) {
954
+ return error;
955
+ }
956
+ }
957
+ return null;
958
+ }
959
+
960
+ return createChainableTypeChecker(validate);
961
+ }
962
+
963
+ function isNode(propValue) {
964
+ switch (typeof propValue) {
965
+ case 'number':
966
+ case 'string':
967
+ case 'undefined':
968
+ return true;
969
+ case 'boolean':
970
+ return !propValue;
971
+ case 'object':
972
+ if (Array.isArray(propValue)) {
973
+ return propValue.every(isNode);
974
+ }
975
+ if (propValue === null || isValidElement(propValue)) {
976
+ return true;
977
+ }
978
+
979
+ var iteratorFn = getIteratorFn(propValue);
980
+ if (iteratorFn) {
981
+ var iterator = iteratorFn.call(propValue);
982
+ var step;
983
+ if (iteratorFn !== propValue.entries) {
984
+ while (!(step = iterator.next()).done) {
985
+ if (!isNode(step.value)) {
986
+ return false;
987
+ }
988
+ }
989
+ } else {
990
+ // Iterator will provide entry [k,v] tuples rather than values.
991
+ while (!(step = iterator.next()).done) {
992
+ var entry = step.value;
993
+ if (entry) {
994
+ if (!isNode(entry[1])) {
995
+ return false;
996
+ }
997
+ }
998
+ }
999
+ }
1000
+ } else {
1001
+ return false;
1002
+ }
1003
+
1004
+ return true;
1005
+ default:
1006
+ return false;
1007
+ }
1008
+ }
1009
+
1010
+ function isSymbol(propType, propValue) {
1011
+ // Native Symbol.
1012
+ if (propType === 'symbol') {
1013
+ return true;
1014
+ }
1015
+
1016
+ // falsy value can't be a Symbol
1017
+ if (!propValue) {
1018
+ return false;
1019
+ }
1020
+
1021
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1022
+ if (propValue['@@toStringTag'] === 'Symbol') {
1023
+ return true;
1024
+ }
1025
+
1026
+ // Fallback for non-spec compliant Symbols which are polyfilled.
1027
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1028
+ return true;
1029
+ }
1030
+
1031
+ return false;
1032
+ }
1033
+
1034
+ // Equivalent of `typeof` but with special handling for array and regexp.
1035
+ function getPropType(propValue) {
1036
+ var propType = typeof propValue;
1037
+ if (Array.isArray(propValue)) {
1038
+ return 'array';
1039
+ }
1040
+ if (propValue instanceof RegExp) {
1041
+ // Old webkits (at least until Android 4.0) return 'function' rather than
1042
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1043
+ // passes PropTypes.object.
1044
+ return 'object';
1045
+ }
1046
+ if (isSymbol(propType, propValue)) {
1047
+ return 'symbol';
1048
+ }
1049
+ return propType;
1050
+ }
1051
+
1052
+ // This handles more types than `getPropType`. Only used for error messages.
1053
+ // See `createPrimitiveTypeChecker`.
1054
+ function getPreciseType(propValue) {
1055
+ if (typeof propValue === 'undefined' || propValue === null) {
1056
+ return '' + propValue;
1057
+ }
1058
+ var propType = getPropType(propValue);
1059
+ if (propType === 'object') {
1060
+ if (propValue instanceof Date) {
1061
+ return 'date';
1062
+ } else if (propValue instanceof RegExp) {
1063
+ return 'regexp';
1064
+ }
1065
+ }
1066
+ return propType;
1067
+ }
1068
+
1069
+ // Returns a string that is postfixed to a warning about an invalid type.
1070
+ // For example, "undefined" or "of type array"
1071
+ function getPostfixForTypeWarning(value) {
1072
+ var type = getPreciseType(value);
1073
+ switch (type) {
1074
+ case 'array':
1075
+ case 'object':
1076
+ return 'an ' + type;
1077
+ case 'boolean':
1078
+ case 'date':
1079
+ case 'regexp':
1080
+ return 'a ' + type;
1081
+ default:
1082
+ return type;
1083
+ }
1084
+ }
1085
+
1086
+ // Returns class name of the object, if any.
1087
+ function getClassName(propValue) {
1088
+ if (!propValue.constructor || !propValue.constructor.name) {
1089
+ return ANONYMOUS;
1090
+ }
1091
+ return propValue.constructor.name;
1092
+ }
1093
+
1094
+ ReactPropTypes.checkPropTypes = checkPropTypes;
1095
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
1096
+ ReactPropTypes.PropTypes = ReactPropTypes;
1097
+
1098
+ return ReactPropTypes;
1099
+ };
1100
+ return factoryWithTypeCheckers;
1101
+ }
1102
+
1103
+ /**
1104
+ * Copyright (c) 2013-present, Facebook, Inc.
1105
+ *
1106
+ * This source code is licensed under the MIT license found in the
1107
+ * LICENSE file in the root directory of this source tree.
1108
+ */
1109
+
1110
+ var factoryWithThrowingShims;
1111
+ var hasRequiredFactoryWithThrowingShims;
1112
+
1113
+ function requireFactoryWithThrowingShims () {
1114
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
1115
+ hasRequiredFactoryWithThrowingShims = 1;
1116
+
1117
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
1118
+
1119
+ function emptyFunction() {}
1120
+ function emptyFunctionWithReset() {}
1121
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1122
+
1123
+ factoryWithThrowingShims = function() {
1124
+ function shim(props, propName, componentName, location, propFullName, secret) {
1125
+ if (secret === ReactPropTypesSecret) {
1126
+ // It is still safe when called from React.
1127
+ return;
1128
+ }
1129
+ var err = new Error(
1130
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1131
+ 'Use PropTypes.checkPropTypes() to call them. ' +
1132
+ 'Read more at http://fb.me/use-check-prop-types'
1133
+ );
1134
+ err.name = 'Invariant Violation';
1135
+ throw err;
1136
+ } shim.isRequired = shim;
1137
+ function getShim() {
1138
+ return shim;
1139
+ } // Important!
1140
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1141
+ var ReactPropTypes = {
1142
+ array: shim,
1143
+ bigint: shim,
1144
+ bool: shim,
1145
+ func: shim,
1146
+ number: shim,
1147
+ object: shim,
1148
+ string: shim,
1149
+ symbol: shim,
1150
+
1151
+ any: shim,
1152
+ arrayOf: getShim,
1153
+ element: shim,
1154
+ elementType: shim,
1155
+ instanceOf: getShim,
1156
+ node: shim,
1157
+ objectOf: getShim,
1158
+ oneOf: getShim,
1159
+ oneOfType: getShim,
1160
+ shape: getShim,
1161
+ exact: getShim,
1162
+
1163
+ checkPropTypes: emptyFunctionWithReset,
1164
+ resetWarningCache: emptyFunction
1165
+ };
1166
+
1167
+ ReactPropTypes.PropTypes = ReactPropTypes;
1168
+
1169
+ return ReactPropTypes;
1170
+ };
1171
+ return factoryWithThrowingShims;
1172
+ }
1173
+
1174
+ /**
1175
+ * Copyright (c) 2013-present, Facebook, Inc.
1176
+ *
1177
+ * This source code is licensed under the MIT license found in the
1178
+ * LICENSE file in the root directory of this source tree.
1179
+ */
1180
+
1181
+ if (process.env.NODE_ENV !== 'production') {
1182
+ var ReactIs = requireReactIs();
1183
+
1184
+ // By explicitly using `prop-types` you are opting into new development behavior.
1185
+ // http://fb.me/prop-types-in-prod
1186
+ var throwOnDirectAccess = true;
1187
+ propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
1188
+ } else {
1189
+ // By explicitly using `prop-types` you are opting into new production behavior.
1190
+ // http://fb.me/prop-types-in-prod
1191
+ propTypes.exports = requireFactoryWithThrowingShims()();
1192
+ }
1193
+
1194
+ var propTypesExports = propTypes.exports;
1195
+ var PropTypes = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(propTypesExports);
1196
+
1197
+ var COMMON_MIME_TYPES = new Map([
1198
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
1199
+ ['aac', 'audio/aac'],
1200
+ ['abw', 'application/x-abiword'],
1201
+ ['arc', 'application/x-freearc'],
1202
+ ['avif', 'image/avif'],
1203
+ ['avi', 'video/x-msvideo'],
1204
+ ['azw', 'application/vnd.amazon.ebook'],
1205
+ ['bin', 'application/octet-stream'],
1206
+ ['bmp', 'image/bmp'],
1207
+ ['bz', 'application/x-bzip'],
1208
+ ['bz2', 'application/x-bzip2'],
1209
+ ['cda', 'application/x-cdf'],
1210
+ ['csh', 'application/x-csh'],
1211
+ ['css', 'text/css'],
1212
+ ['csv', 'text/csv'],
1213
+ ['doc', 'application/msword'],
1214
+ ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
1215
+ ['eot', 'application/vnd.ms-fontobject'],
1216
+ ['epub', 'application/epub+zip'],
1217
+ ['gz', 'application/gzip'],
1218
+ ['gif', 'image/gif'],
1219
+ ['htm', 'text/html'],
1220
+ ['html', 'text/html'],
1221
+ ['ico', 'image/vnd.microsoft.icon'],
1222
+ ['ics', 'text/calendar'],
1223
+ ['jar', 'application/java-archive'],
1224
+ ['jpeg', 'image/jpeg'],
1225
+ ['jpg', 'image/jpeg'],
1226
+ ['js', 'text/javascript'],
1227
+ ['json', 'application/json'],
1228
+ ['jsonld', 'application/ld+json'],
1229
+ ['mid', 'audio/midi'],
1230
+ ['midi', 'audio/midi'],
1231
+ ['mjs', 'text/javascript'],
1232
+ ['mp3', 'audio/mpeg'],
1233
+ ['mp4', 'video/mp4'],
1234
+ ['mpeg', 'video/mpeg'],
1235
+ ['mpkg', 'application/vnd.apple.installer+xml'],
1236
+ ['odp', 'application/vnd.oasis.opendocument.presentation'],
1237
+ ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
1238
+ ['odt', 'application/vnd.oasis.opendocument.text'],
1239
+ ['oga', 'audio/ogg'],
1240
+ ['ogv', 'video/ogg'],
1241
+ ['ogx', 'application/ogg'],
1242
+ ['opus', 'audio/opus'],
1243
+ ['otf', 'font/otf'],
1244
+ ['png', 'image/png'],
1245
+ ['pdf', 'application/pdf'],
1246
+ ['php', 'application/x-httpd-php'],
1247
+ ['ppt', 'application/vnd.ms-powerpoint'],
1248
+ ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
1249
+ ['rar', 'application/vnd.rar'],
1250
+ ['rtf', 'application/rtf'],
1251
+ ['sh', 'application/x-sh'],
1252
+ ['svg', 'image/svg+xml'],
1253
+ ['swf', 'application/x-shockwave-flash'],
1254
+ ['tar', 'application/x-tar'],
1255
+ ['tif', 'image/tiff'],
1256
+ ['tiff', 'image/tiff'],
1257
+ ['ts', 'video/mp2t'],
1258
+ ['ttf', 'font/ttf'],
1259
+ ['txt', 'text/plain'],
1260
+ ['vsd', 'application/vnd.visio'],
1261
+ ['wav', 'audio/wav'],
1262
+ ['weba', 'audio/webm'],
1263
+ ['webm', 'video/webm'],
1264
+ ['webp', 'image/webp'],
1265
+ ['woff', 'font/woff'],
1266
+ ['woff2', 'font/woff2'],
1267
+ ['xhtml', 'application/xhtml+xml'],
1268
+ ['xls', 'application/vnd.ms-excel'],
1269
+ ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
1270
+ ['xml', 'application/xml'],
1271
+ ['xul', 'application/vnd.mozilla.xul+xml'],
1272
+ ['zip', 'application/zip'],
1273
+ ['7z', 'application/x-7z-compressed'],
1274
+ // Others
1275
+ ['mkv', 'video/x-matroska'],
1276
+ ['mov', 'video/quicktime'],
1277
+ ['msg', 'application/vnd.ms-outlook']
1278
+ ]);
1279
+ function toFileWithPath(file, path) {
1280
+ var f = withMimeType(file);
1281
+ if (typeof f.path !== 'string') { // on electron, path is already set to the absolute path
1282
+ var webkitRelativePath = file.webkitRelativePath;
1283
+ Object.defineProperty(f, 'path', {
1284
+ value: typeof path === 'string'
1285
+ ? path
1286
+ // If <input webkitdirectory> is set,
1287
+ // the File will have a {webkitRelativePath} property
1288
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory
1289
+ : typeof webkitRelativePath === 'string' && webkitRelativePath.length > 0
1290
+ ? webkitRelativePath
1291
+ : file.name,
1292
+ writable: false,
1293
+ configurable: false,
1294
+ enumerable: true
1295
+ });
1296
+ }
1297
+ return f;
1298
+ }
1299
+ function withMimeType(file) {
1300
+ var name = file.name;
1301
+ var hasExtension = name && name.lastIndexOf('.') !== -1;
1302
+ if (hasExtension && !file.type) {
1303
+ var ext = name.split('.')
1304
+ .pop().toLowerCase();
1305
+ var type = COMMON_MIME_TYPES.get(ext);
1306
+ if (type) {
1307
+ Object.defineProperty(file, 'type', {
1308
+ value: type,
1309
+ writable: false,
1310
+ configurable: false,
1311
+ enumerable: true
1312
+ });
1313
+ }
1314
+ }
1315
+ return file;
1316
+ }
1317
+
1318
+ var FILES_TO_IGNORE = [
1319
+ // Thumbnail cache files for macOS and Windows
1320
+ '.DS_Store',
1321
+ 'Thumbs.db' // Windows
1322
+ ];
1323
+ /**
1324
+ * Convert a DragEvent's DataTrasfer object to a list of File objects
1325
+ * NOTE: If some of the items are folders,
1326
+ * everything will be flattened and placed in the same list but the paths will be kept as a {path} property.
1327
+ *
1328
+ * EXPERIMENTAL: A list of https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle objects can also be passed as an arg
1329
+ * and a list of File objects will be returned.
1330
+ *
1331
+ * @param evt
1332
+ */
1333
+ function fromEvent(evt) {
1334
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
1335
+ return tslib_es6.__generator(this, function (_a) {
1336
+ if (isObject(evt) && isDataTransfer(evt)) {
1337
+ return [2 /*return*/, getDataTransferFiles(evt.dataTransfer, evt.type)];
1338
+ }
1339
+ else if (isChangeEvt(evt)) {
1340
+ return [2 /*return*/, getInputFiles(evt)];
1341
+ }
1342
+ else if (Array.isArray(evt) && evt.every(function (item) { return 'getFile' in item && typeof item.getFile === 'function'; })) {
1343
+ return [2 /*return*/, getFsHandleFiles(evt)];
1344
+ }
1345
+ return [2 /*return*/, []];
1346
+ });
1347
+ });
1348
+ }
1349
+ function isDataTransfer(value) {
1350
+ return isObject(value.dataTransfer);
1351
+ }
1352
+ function isChangeEvt(value) {
1353
+ return isObject(value) && isObject(value.target);
1354
+ }
1355
+ function isObject(v) {
1356
+ return typeof v === 'object' && v !== null;
1357
+ }
1358
+ function getInputFiles(evt) {
1359
+ return fromList(evt.target.files).map(function (file) { return toFileWithPath(file); });
1360
+ }
1361
+ // Ee expect each handle to be https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
1362
+ function getFsHandleFiles(handles) {
1363
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
1364
+ var files;
1365
+ return tslib_es6.__generator(this, function (_a) {
1366
+ switch (_a.label) {
1367
+ case 0: return [4 /*yield*/, Promise.all(handles.map(function (h) { return h.getFile(); }))];
1368
+ case 1:
1369
+ files = _a.sent();
1370
+ return [2 /*return*/, files.map(function (file) { return toFileWithPath(file); })];
1371
+ }
1372
+ });
1373
+ });
1374
+ }
1375
+ function getDataTransferFiles(dt, type) {
1376
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
1377
+ var items, files;
1378
+ return tslib_es6.__generator(this, function (_a) {
1379
+ switch (_a.label) {
1380
+ case 0:
1381
+ if (dt === null) {
1382
+ return [2 /*return*/, []];
1383
+ }
1384
+ if (!dt.items) return [3 /*break*/, 2];
1385
+ items = fromList(dt.items)
1386
+ .filter(function (item) { return item.kind === 'file'; });
1387
+ // According to https://html.spec.whatwg.org/multipage/dnd.html#dndevents,
1388
+ // only 'dragstart' and 'drop' has access to the data (source node)
1389
+ if (type !== 'drop') {
1390
+ return [2 /*return*/, items];
1391
+ }
1392
+ return [4 /*yield*/, Promise.all(items.map(toFilePromises))];
1393
+ case 1:
1394
+ files = _a.sent();
1395
+ return [2 /*return*/, noIgnoredFiles(flatten(files))];
1396
+ case 2: return [2 /*return*/, noIgnoredFiles(fromList(dt.files)
1397
+ .map(function (file) { return toFileWithPath(file); }))];
1398
+ }
1399
+ });
1400
+ });
1401
+ }
1402
+ function noIgnoredFiles(files) {
1403
+ return files.filter(function (file) { return FILES_TO_IGNORE.indexOf(file.name) === -1; });
1404
+ }
1405
+ // IE11 does not support Array.from()
1406
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Browser_compatibility
1407
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileList
1408
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList
1409
+ function fromList(items) {
1410
+ if (items === null) {
1411
+ return [];
1412
+ }
1413
+ var files = [];
1414
+ // tslint:disable: prefer-for-of
1415
+ for (var i = 0; i < items.length; i++) {
1416
+ var file = items[i];
1417
+ files.push(file);
1418
+ }
1419
+ return files;
1420
+ }
1421
+ // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
1422
+ function toFilePromises(item) {
1423
+ if (typeof item.webkitGetAsEntry !== 'function') {
1424
+ return fromDataTransferItem(item);
1425
+ }
1426
+ var entry = item.webkitGetAsEntry();
1427
+ // Safari supports dropping an image node from a different window and can be retrieved using
1428
+ // the DataTransferItem.getAsFile() API
1429
+ // NOTE: FileSystemEntry.file() throws if trying to get the file
1430
+ if (entry && entry.isDirectory) {
1431
+ return fromDirEntry(entry);
1432
+ }
1433
+ return fromDataTransferItem(item);
1434
+ }
1435
+ function flatten(items) {
1436
+ return items.reduce(function (acc, files) { return tslib_es6.__spread(acc, (Array.isArray(files) ? flatten(files) : [files])); }, []);
1437
+ }
1438
+ function fromDataTransferItem(item) {
1439
+ var file = item.getAsFile();
1440
+ if (!file) {
1441
+ return Promise.reject(item + " is not a File");
1442
+ }
1443
+ var fwp = toFileWithPath(file);
1444
+ return Promise.resolve(fwp);
1445
+ }
1446
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemEntry
1447
+ function fromEntry(entry) {
1448
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
1449
+ return tslib_es6.__generator(this, function (_a) {
1450
+ return [2 /*return*/, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
1451
+ });
1452
+ });
1453
+ }
1454
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry
1455
+ function fromDirEntry(entry) {
1456
+ var reader = entry.createReader();
1457
+ return new Promise(function (resolve, reject) {
1458
+ var entries = [];
1459
+ function readEntries() {
1460
+ var _this = this;
1461
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/createReader
1462
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries
1463
+ reader.readEntries(function (batch) { return tslib_es6.__awaiter(_this, void 0, void 0, function () {
1464
+ var files, err_1, items;
1465
+ return tslib_es6.__generator(this, function (_a) {
1466
+ switch (_a.label) {
1467
+ case 0:
1468
+ if (!!batch.length) return [3 /*break*/, 5];
1469
+ _a.label = 1;
1470
+ case 1:
1471
+ _a.trys.push([1, 3, , 4]);
1472
+ return [4 /*yield*/, Promise.all(entries)];
1473
+ case 2:
1474
+ files = _a.sent();
1475
+ resolve(files);
1476
+ return [3 /*break*/, 4];
1477
+ case 3:
1478
+ err_1 = _a.sent();
1479
+ reject(err_1);
1480
+ return [3 /*break*/, 4];
1481
+ case 4: return [3 /*break*/, 6];
1482
+ case 5:
1483
+ items = Promise.all(batch.map(fromEntry));
1484
+ entries.push(items);
1485
+ // Continue reading
1486
+ readEntries();
1487
+ _a.label = 6;
1488
+ case 6: return [2 /*return*/];
1489
+ }
1490
+ });
1491
+ }); }, function (err) {
1492
+ reject(err);
1493
+ });
1494
+ }
1495
+ readEntries();
1496
+ });
1497
+ }
1498
+ // https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileEntry
1499
+ function fromFileEntry(entry) {
1500
+ return tslib_es6.__awaiter(this, void 0, void 0, function () {
1501
+ return tslib_es6.__generator(this, function (_a) {
1502
+ return [2 /*return*/, new Promise(function (resolve, reject) {
1503
+ entry.file(function (file) {
1504
+ var fwp = toFileWithPath(file, entry.fullPath);
1505
+ resolve(fwp);
1506
+ }, function (err) {
1507
+ reject(err);
1508
+ });
1509
+ })];
1510
+ });
1511
+ });
1512
+ }
1513
+
1514
+ var _default = function (file, acceptedFiles) {
1515
+ if (file && acceptedFiles) {
1516
+ var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
1517
+ var fileName = file.name || '';
1518
+ var mimeType = (file.type || '').toLowerCase();
1519
+ var baseMimeType = mimeType.replace(/\/.*$/, '');
1520
+ return acceptedFilesArray.some(function (type) {
1521
+ var validType = type.trim().toLowerCase();
1522
+
1523
+ if (validType.charAt(0) === '.') {
1524
+ return fileName.toLowerCase().endsWith(validType);
1525
+ } else if (validType.endsWith('/*')) {
1526
+ // This is something like a image/* mime type
1527
+ return baseMimeType === validType.replace(/\/.*$/, '');
1528
+ }
1529
+
1530
+ return mimeType === validType;
1531
+ });
1532
+ }
1533
+
1534
+ return true;
1535
+ };
1536
+
1537
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1538
+
1539
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1540
+
1541
+ function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1542
+
1543
+ function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
1544
+
1545
+ function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1546
+
1547
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
1548
+
1549
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1550
+
1551
+ function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1552
+
1553
+ function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
1554
+
1555
+ var FILE_INVALID_TYPE = 'file-invalid-type';
1556
+ var FILE_TOO_LARGE = 'file-too-large';
1557
+ var FILE_TOO_SMALL = 'file-too-small';
1558
+ var TOO_MANY_FILES = 'too-many-files';
1559
+
1560
+ var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr(accept) {
1561
+ accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
1562
+ var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(', ')) : accept;
1563
+ return {
1564
+ code: FILE_INVALID_TYPE,
1565
+ message: "File type must be ".concat(messageSuffix)
1566
+ };
1567
+ };
1568
+ var getTooLargeRejectionErr = function getTooLargeRejectionErr(maxSize) {
1569
+ return {
1570
+ code: FILE_TOO_LARGE,
1571
+ message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? 'byte' : 'bytes')
1572
+ };
1573
+ };
1574
+ var getTooSmallRejectionErr = function getTooSmallRejectionErr(minSize) {
1575
+ return {
1576
+ code: FILE_TOO_SMALL,
1577
+ message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? 'byte' : 'bytes')
1578
+ };
1579
+ };
1580
+ var TOO_MANY_FILES_REJECTION = {
1581
+ code: TOO_MANY_FILES,
1582
+ message: 'Too many files'
1583
+ }; // Firefox versions prior to 53 return a bogus MIME type for every file drag, so dragovers with
1584
+ // that MIME type will always be accepted
1585
+
1586
+ function fileAccepted(file, accept) {
1587
+ var isAcceptable = file.type === 'application/x-moz-file' || _default(file, accept);
1588
+ return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
1589
+ }
1590
+ function fileMatchSize(file, minSize, maxSize) {
1591
+ if (isDefined(file.size)) {
1592
+ if (isDefined(minSize) && isDefined(maxSize)) {
1593
+ if (file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
1594
+ if (file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];
1595
+ } else if (isDefined(minSize) && file.size < minSize) return [false, getTooSmallRejectionErr(minSize)];else if (isDefined(maxSize) && file.size > maxSize) return [false, getTooLargeRejectionErr(maxSize)];
1596
+ }
1597
+
1598
+ return [true, null];
1599
+ }
1600
+
1601
+ function isDefined(value) {
1602
+ return value !== undefined && value !== null;
1603
+ }
1604
+
1605
+ function allFilesAccepted(_ref) {
1606
+ var files = _ref.files,
1607
+ accept = _ref.accept,
1608
+ minSize = _ref.minSize,
1609
+ maxSize = _ref.maxSize,
1610
+ multiple = _ref.multiple,
1611
+ maxFiles = _ref.maxFiles;
1612
+
1613
+ if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
1614
+ return false;
1615
+ }
1616
+
1617
+ return files.every(function (file) {
1618
+ var _fileAccepted = fileAccepted(file, accept),
1619
+ _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1),
1620
+ accepted = _fileAccepted2[0];
1621
+
1622
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
1623
+ _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1),
1624
+ sizeMatch = _fileMatchSize2[0];
1625
+
1626
+ return accepted && sizeMatch;
1627
+ });
1628
+ } // React's synthetic events has event.isPropagationStopped,
1629
+ // but to remain compatibility with other libs (Preact) fall back
1630
+ // to check event.cancelBubble
1631
+
1632
+ function isPropagationStopped(event) {
1633
+ if (typeof event.isPropagationStopped === 'function') {
1634
+ return event.isPropagationStopped();
1635
+ } else if (typeof event.cancelBubble !== 'undefined') {
1636
+ return event.cancelBubble;
1637
+ }
1638
+
1639
+ return false;
1640
+ }
1641
+ function isEvtWithFiles(event) {
1642
+ if (!event.dataTransfer) {
1643
+ return !!event.target && !!event.target.files;
1644
+ } // https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/types
1645
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types#file
1646
+
1647
+
1648
+ return Array.prototype.some.call(event.dataTransfer.types, function (type) {
1649
+ return type === 'Files' || type === 'application/x-moz-file';
1650
+ });
1651
+ }
1652
+
1653
+ function onDocumentDragOver(event) {
1654
+ event.preventDefault();
1655
+ }
1656
+
1657
+ function isIe(userAgent) {
1658
+ return userAgent.indexOf('MSIE') !== -1 || userAgent.indexOf('Trident/') !== -1;
1659
+ }
1660
+
1661
+ function isEdge(userAgent) {
1662
+ return userAgent.indexOf('Edge/') !== -1;
1663
+ }
1664
+
1665
+ function isIeOrEdge() {
1666
+ var userAgent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
1667
+ return isIe(userAgent) || isEdge(userAgent);
1668
+ }
1669
+ /**
1670
+ * This is intended to be used to compose event handlers
1671
+ * They are executed in order until one of them calls `event.isPropagationStopped()`.
1672
+ * Note that the check is done on the first invoke too,
1673
+ * meaning that if propagation was stopped before invoking the fns,
1674
+ * no handlers will be executed.
1675
+ *
1676
+ * @param {Function} fns the event hanlder functions
1677
+ * @return {Function} the event handler to add to an element
1678
+ */
1679
+
1680
+ function composeEventHandlers() {
1681
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
1682
+ fns[_key] = arguments[_key];
1683
+ }
1684
+
1685
+ return function (event) {
1686
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1687
+ args[_key2 - 1] = arguments[_key2];
1688
+ }
1689
+
1690
+ return fns.some(function (fn) {
1691
+ if (!isPropagationStopped(event) && fn) {
1692
+ fn.apply(void 0, [event].concat(args));
1693
+ }
1694
+
1695
+ return isPropagationStopped(event);
1696
+ });
1697
+ };
1698
+ }
1699
+ /**
1700
+ * canUseFileSystemAccessAPI checks if the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API)
1701
+ * is supported by the browser.
1702
+ * @returns {boolean}
1703
+ */
1704
+
1705
+ function canUseFileSystemAccessAPI() {
1706
+ return 'showOpenFilePicker' in window;
1707
+ }
1708
+ /**
1709
+ * filePickerOptionsTypes returns the {types} option for https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
1710
+ * based on the accept attr (see https://github.com/react-dropzone/attr-accept)
1711
+ * E.g: converts ['image/*', 'text/*'] to {'image/*': [], 'text/*': []}
1712
+ * @param {string|string[]} accept
1713
+ */
1714
+
1715
+ function filePickerOptionsTypes(accept) {
1716
+ accept = typeof accept === 'string' ? accept.split(',') : accept;
1717
+ return [{
1718
+ description: 'everything',
1719
+ // TODO: Need to handle filtering more elegantly than this!
1720
+ accept: Array.isArray(accept) // Accept just MIME types as per spec
1721
+ // NOTE: accept can be https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers
1722
+ ? accept.filter(function (item) {
1723
+ return item === 'audio/*' || item === 'video/*' || item === 'image/*' || item === 'text/*' || /\w+\/[-+.\w]+/g.test(item);
1724
+ }).reduce(function (a, b) {
1725
+ return _objectSpread$1(_objectSpread$1({}, a), {}, _defineProperty$1({}, b, []));
1726
+ }, {}) : {}
1727
+ }];
1728
+ }
1729
+
1730
+ var _excluded = ["children"],
1731
+ _excluded2 = ["open"],
1732
+ _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
1733
+ _excluded4 = ["refKey", "onChange", "onClick"];
1734
+
1735
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1736
+
1737
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1738
+
1739
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1740
+
1741
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1742
+
1743
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1744
+
1745
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1746
+
1747
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1748
+
1749
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1750
+
1751
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1752
+
1753
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1754
+
1755
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1756
+
1757
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1758
+
1759
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1760
+
1761
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
1762
+
1763
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1764
+ /**
1765
+ * Convenience wrapper component for the `useDropzone` hook
1766
+ *
1767
+ * ```jsx
1768
+ * <Dropzone>
1769
+ * {({getRootProps, getInputProps}) => (
1770
+ * <div {...getRootProps()}>
1771
+ * <input {...getInputProps()} />
1772
+ * <p>Drag 'n' drop some files here, or click to select files</p>
1773
+ * </div>
1774
+ * )}
1775
+ * </Dropzone>
1776
+ * ```
1777
+ */
1778
+
1779
+ var Dropzone = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
1780
+ var children = _ref.children,
1781
+ params = _objectWithoutProperties(_ref, _excluded);
1782
+
1783
+ var _useDropzone = useDropzone(params),
1784
+ open = _useDropzone.open,
1785
+ props = _objectWithoutProperties(_useDropzone, _excluded2);
1786
+
1787
+ React.useImperativeHandle(ref, function () {
1788
+ return {
1789
+ open: open
1790
+ };
1791
+ }, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
1792
+
1793
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
1794
+ open: open
1795
+ })));
1796
+ });
1797
+ Dropzone.displayName = 'Dropzone'; // Add default props for react-docgen
1798
+
1799
+ var defaultProps = {
1800
+ disabled: false,
1801
+ getFilesFromEvent: fromEvent,
1802
+ maxSize: Infinity,
1803
+ minSize: 0,
1804
+ multiple: true,
1805
+ maxFiles: 0,
1806
+ preventDropOnDocument: true,
1807
+ noClick: false,
1808
+ noKeyboard: false,
1809
+ noDrag: false,
1810
+ noDragEventsBubbling: false,
1811
+ validator: null,
1812
+ useFsAccessApi: false
1813
+ };
1814
+ Dropzone.defaultProps = defaultProps;
1815
+ Dropzone.propTypes = {
1816
+ /**
1817
+ * Render function that exposes the dropzone state and prop getter fns
1818
+ *
1819
+ * @param {object} params
1820
+ * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
1821
+ * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
1822
+ * @param {Function} params.open Open the native file selection dialog
1823
+ * @param {boolean} params.isFocused Dropzone area is in focus
1824
+ * @param {boolean} params.isFileDialogActive File dialog is opened
1825
+ * @param {boolean} params.isDragActive Active drag is in progress
1826
+ * @param {boolean} params.isDragAccept Dragged files are accepted
1827
+ * @param {boolean} params.isDragReject Some dragged files are rejected
1828
+ * @param {File[]} params.draggedFiles Files in active drag
1829
+ * @param {File[]} params.acceptedFiles Accepted files
1830
+ * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
1831
+ */
1832
+ children: PropTypes.func,
1833
+
1834
+ /**
1835
+ * Set accepted file types.
1836
+ * See https://github.com/okonet/attr-accept for more information.
1837
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
1838
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
1839
+ * Windows. In some cases there might not be a mime type set at all.
1840
+ * See: https://github.com/react-dropzone/react-dropzone/issues/276
1841
+ */
1842
+ accept: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
1843
+
1844
+ /**
1845
+ * Allow drag 'n' drop (or selection from the file dialog) of multiple files
1846
+ */
1847
+ multiple: PropTypes.bool,
1848
+
1849
+ /**
1850
+ * If false, allow dropped items to take over the current browser window
1851
+ */
1852
+ preventDropOnDocument: PropTypes.bool,
1853
+
1854
+ /**
1855
+ * If true, disables click to open the native file selection dialog
1856
+ */
1857
+ noClick: PropTypes.bool,
1858
+
1859
+ /**
1860
+ * If true, disables SPACE/ENTER to open the native file selection dialog.
1861
+ * Note that it also stops tracking the focus state.
1862
+ */
1863
+ noKeyboard: PropTypes.bool,
1864
+
1865
+ /**
1866
+ * If true, disables drag 'n' drop
1867
+ */
1868
+ noDrag: PropTypes.bool,
1869
+
1870
+ /**
1871
+ * If true, stops drag event propagation to parents
1872
+ */
1873
+ noDragEventsBubbling: PropTypes.bool,
1874
+
1875
+ /**
1876
+ * Minimum file size (in bytes)
1877
+ */
1878
+ minSize: PropTypes.number,
1879
+
1880
+ /**
1881
+ * Maximum file size (in bytes)
1882
+ */
1883
+ maxSize: PropTypes.number,
1884
+
1885
+ /**
1886
+ * Maximum accepted number of files
1887
+ * The default value is 0 which means there is no limitation to how many files are accepted.
1888
+ */
1889
+ maxFiles: PropTypes.number,
1890
+
1891
+ /**
1892
+ * Enable/disable the dropzone
1893
+ */
1894
+ disabled: PropTypes.bool,
1895
+
1896
+ /**
1897
+ * Use this to provide a custom file aggregator
1898
+ *
1899
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
1900
+ */
1901
+ getFilesFromEvent: PropTypes.func,
1902
+
1903
+ /**
1904
+ * Cb for when closing the file dialog with no selection
1905
+ */
1906
+ onFileDialogCancel: PropTypes.func,
1907
+
1908
+ /**
1909
+ * Cb for when opening the file dialog
1910
+ */
1911
+ onFileDialogOpen: PropTypes.func,
1912
+
1913
+ /**
1914
+ * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
1915
+ * to open the file picker instead of using an `<input type="file">` click event.
1916
+ */
1917
+ useFsAccessApi: PropTypes.bool,
1918
+
1919
+ /**
1920
+ * Cb for when the `dragenter` event occurs.
1921
+ *
1922
+ * @param {DragEvent} event
1923
+ */
1924
+ onDragEnter: PropTypes.func,
1925
+
1926
+ /**
1927
+ * Cb for when the `dragleave` event occurs
1928
+ *
1929
+ * @param {DragEvent} event
1930
+ */
1931
+ onDragLeave: PropTypes.func,
1932
+
1933
+ /**
1934
+ * Cb for when the `dragover` event occurs
1935
+ *
1936
+ * @param {DragEvent} event
1937
+ */
1938
+ onDragOver: PropTypes.func,
1939
+
1940
+ /**
1941
+ * Cb for when the `drop` event occurs.
1942
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
1943
+ *
1944
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
1945
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
1946
+ * If `multiple` is set to false and additional files are dropped,
1947
+ * all files besides the first will be rejected.
1948
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
1949
+ *
1950
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
1951
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
1952
+ *
1953
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
1954
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
1955
+ *
1956
+ * ```js
1957
+ * function onDrop(acceptedFiles) {
1958
+ * const req = request.post('/upload')
1959
+ * acceptedFiles.forEach(file => {
1960
+ * req.attach(file.name, file)
1961
+ * })
1962
+ * req.end(callback)
1963
+ * }
1964
+ * ```
1965
+ *
1966
+ * @param {File[]} acceptedFiles
1967
+ * @param {FileRejection[]} fileRejections
1968
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
1969
+ */
1970
+ onDrop: PropTypes.func,
1971
+
1972
+ /**
1973
+ * Cb for when the `drop` event occurs.
1974
+ * Note that if no files are accepted, this callback is not invoked.
1975
+ *
1976
+ * @param {File[]} files
1977
+ * @param {(DragEvent|Event)} event
1978
+ */
1979
+ onDropAccepted: PropTypes.func,
1980
+
1981
+ /**
1982
+ * Cb for when the `drop` event occurs.
1983
+ * Note that if no files are rejected, this callback is not invoked.
1984
+ *
1985
+ * @param {FileRejection[]} fileRejections
1986
+ * @param {(DragEvent|Event)} event
1987
+ */
1988
+ onDropRejected: PropTypes.func,
1989
+
1990
+ /**
1991
+ * Custom validation function
1992
+ * @param {File} file
1993
+ * @returns {FileError|FileError[]}
1994
+ */
1995
+ validator: PropTypes.func
1996
+ };
1997
+ /**
1998
+ * A function that is invoked for the `dragenter`,
1999
+ * `dragover` and `dragleave` events.
2000
+ * It is not invoked if the items are not files (such as link, text, etc.).
2001
+ *
2002
+ * @callback dragCb
2003
+ * @param {DragEvent} event
2004
+ */
2005
+
2006
+ /**
2007
+ * A function that is invoked for the `drop` or input change event.
2008
+ * It is not invoked if the items are not files (such as link, text, etc.).
2009
+ *
2010
+ * @callback dropCb
2011
+ * @param {File[]} acceptedFiles List of accepted files
2012
+ * @param {FileRejection[]} fileRejections List of rejected files and why they were rejected
2013
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2014
+ */
2015
+
2016
+ /**
2017
+ * A function that is invoked for the `drop` or input change event.
2018
+ * It is not invoked if the items are files (such as link, text, etc.).
2019
+ *
2020
+ * @callback dropAcceptedCb
2021
+ * @param {File[]} files List of accepted files that meet the given criteria
2022
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
2023
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2024
+ */
2025
+
2026
+ /**
2027
+ * A function that is invoked for the `drop` or input change event.
2028
+ *
2029
+ * @callback dropRejectedCb
2030
+ * @param {File[]} files List of rejected files that do not meet the given criteria
2031
+ * (`accept`, `multiple`, `minSize`, `maxSize`)
2032
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2033
+ */
2034
+
2035
+ /**
2036
+ * A function that is used aggregate files,
2037
+ * in a asynchronous fashion, from drag or input change events.
2038
+ *
2039
+ * @callback getFilesFromEvent
2040
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
2041
+ * @returns {(File[]|Promise<File[]>)}
2042
+ */
2043
+
2044
+ /**
2045
+ * An object with the current dropzone state and some helper functions.
2046
+ *
2047
+ * @typedef {object} DropzoneState
2048
+ * @property {Function} getRootProps Returns the props you should apply to the root drop container you render
2049
+ * @property {Function} getInputProps Returns the props you should apply to hidden file input you render
2050
+ * @property {Function} open Open the native file selection dialog
2051
+ * @property {boolean} isFocused Dropzone area is in focus
2052
+ * @property {boolean} isFileDialogActive File dialog is opened
2053
+ * @property {boolean} isDragActive Active drag is in progress
2054
+ * @property {boolean} isDragAccept Dragged files are accepted
2055
+ * @property {boolean} isDragReject Some dragged files are rejected
2056
+ * @property {File[]} draggedFiles Files in active drag
2057
+ * @property {File[]} acceptedFiles Accepted files
2058
+ * @property {FileRejection[]} fileRejections Rejected files and why they were rejected
2059
+ */
2060
+
2061
+ var initialState = {
2062
+ isFocused: false,
2063
+ isFileDialogActive: false,
2064
+ isDragActive: false,
2065
+ isDragAccept: false,
2066
+ isDragReject: false,
2067
+ draggedFiles: [],
2068
+ acceptedFiles: [],
2069
+ fileRejections: []
2070
+ };
2071
+ /**
2072
+ * A React hook that creates a drag 'n' drop area.
2073
+ *
2074
+ * ```jsx
2075
+ * function MyDropzone(props) {
2076
+ * const {getRootProps, getInputProps} = useDropzone({
2077
+ * onDrop: acceptedFiles => {
2078
+ * // do something with the File objects, e.g. upload to some server
2079
+ * }
2080
+ * });
2081
+ * return (
2082
+ * <div {...getRootProps()}>
2083
+ * <input {...getInputProps()} />
2084
+ * <p>Drag and drop some files here, or click to select files</p>
2085
+ * </div>
2086
+ * )
2087
+ * }
2088
+ * ```
2089
+ *
2090
+ * @function useDropzone
2091
+ *
2092
+ * @param {object} props
2093
+ * @param {string|string[]} [props.accept] Set accepted file types.
2094
+ * See https://github.com/okonet/attr-accept for more information.
2095
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
2096
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
2097
+ * Windows. In some cases there might not be a mime type set at all.
2098
+ * See: https://github.com/react-dropzone/react-dropzone/issues/276
2099
+ * @param {boolean} [props.multiple=true] Allow drag 'n' drop (or selection from the file dialog) of multiple files
2100
+ * @param {boolean} [props.preventDropOnDocument=true] If false, allow dropped items to take over the current browser window
2101
+ * @param {boolean} [props.noClick=false] If true, disables click to open the native file selection dialog
2102
+ * @param {boolean} [props.noKeyboard=false] If true, disables SPACE/ENTER to open the native file selection dialog.
2103
+ * Note that it also stops tracking the focus state.
2104
+ * @param {boolean} [props.noDrag=false] If true, disables drag 'n' drop
2105
+ * @param {boolean} [props.noDragEventsBubbling=false] If true, stops drag event propagation to parents
2106
+ * @param {number} [props.minSize=0] Minimum file size (in bytes)
2107
+ * @param {number} [props.maxSize=Infinity] Maximum file size (in bytes)
2108
+ * @param {boolean} [props.disabled=false] Enable/disable the dropzone
2109
+ * @param {getFilesFromEvent} [props.getFilesFromEvent] Use this to provide a custom file aggregator
2110
+ * @param {Function} [props.onFileDialogCancel] Cb for when closing the file dialog with no selection
2111
+ * @param {boolean} [props.useFsAccessApi] Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
2112
+ * to open the file picker instead of using an `<input type="file">` click event.
2113
+ * @param {Function} [props.onFileDialogOpen] Cb for when opening the file dialog
2114
+ * @param {dragCb} [props.onDragEnter] Cb for when the `dragenter` event occurs.
2115
+ * @param {dragCb} [props.onDragLeave] Cb for when the `dragleave` event occurs
2116
+ * @param {dragCb} [props.onDragOver] Cb for when the `dragover` event occurs
2117
+ * @param {dropCb} [props.onDrop] Cb for when the `drop` event occurs.
2118
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
2119
+ *
2120
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
2121
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
2122
+ * If `multiple` is set to false and additional files are dropped,
2123
+ * all files besides the first will be rejected.
2124
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
2125
+ *
2126
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
2127
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
2128
+ *
2129
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
2130
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
2131
+ *
2132
+ * ```js
2133
+ * function onDrop(acceptedFiles) {
2134
+ * const req = request.post('/upload')
2135
+ * acceptedFiles.forEach(file => {
2136
+ * req.attach(file.name, file)
2137
+ * })
2138
+ * req.end(callback)
2139
+ * }
2140
+ * ```
2141
+ * @param {dropAcceptedCb} [props.onDropAccepted]
2142
+ * @param {dropRejectedCb} [props.onDropRejected]
2143
+ *
2144
+ * @returns {DropzoneState}
2145
+ */
2146
+
2147
+ function useDropzone() {
2148
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2149
+
2150
+ var _defaultProps$options = _objectSpread(_objectSpread({}, defaultProps), options),
2151
+ accept = _defaultProps$options.accept,
2152
+ disabled = _defaultProps$options.disabled,
2153
+ getFilesFromEvent = _defaultProps$options.getFilesFromEvent,
2154
+ maxSize = _defaultProps$options.maxSize,
2155
+ minSize = _defaultProps$options.minSize,
2156
+ multiple = _defaultProps$options.multiple,
2157
+ maxFiles = _defaultProps$options.maxFiles,
2158
+ onDragEnter = _defaultProps$options.onDragEnter,
2159
+ onDragLeave = _defaultProps$options.onDragLeave,
2160
+ onDragOver = _defaultProps$options.onDragOver,
2161
+ onDrop = _defaultProps$options.onDrop,
2162
+ onDropAccepted = _defaultProps$options.onDropAccepted,
2163
+ onDropRejected = _defaultProps$options.onDropRejected,
2164
+ onFileDialogCancel = _defaultProps$options.onFileDialogCancel,
2165
+ onFileDialogOpen = _defaultProps$options.onFileDialogOpen,
2166
+ useFsAccessApi = _defaultProps$options.useFsAccessApi,
2167
+ preventDropOnDocument = _defaultProps$options.preventDropOnDocument,
2168
+ noClick = _defaultProps$options.noClick,
2169
+ noKeyboard = _defaultProps$options.noKeyboard,
2170
+ noDrag = _defaultProps$options.noDrag,
2171
+ noDragEventsBubbling = _defaultProps$options.noDragEventsBubbling,
2172
+ validator = _defaultProps$options.validator;
2173
+
2174
+ var onFileDialogOpenCb = React.useMemo(function () {
2175
+ return typeof onFileDialogOpen === 'function' ? onFileDialogOpen : noop;
2176
+ }, [onFileDialogOpen]);
2177
+ var onFileDialogCancelCb = React.useMemo(function () {
2178
+ return typeof onFileDialogCancel === 'function' ? onFileDialogCancel : noop;
2179
+ }, [onFileDialogCancel]);
2180
+ var rootRef = React.useRef(null);
2181
+ var inputRef = React.useRef(null);
2182
+
2183
+ var _useReducer = React.useReducer(reducer, initialState),
2184
+ _useReducer2 = _slicedToArray(_useReducer, 2),
2185
+ state = _useReducer2[0],
2186
+ dispatch = _useReducer2[1];
2187
+
2188
+ var isFocused = state.isFocused,
2189
+ isFileDialogActive = state.isFileDialogActive,
2190
+ draggedFiles = state.draggedFiles; // Update file dialog active state when the window is focused on
2191
+
2192
+ var onWindowFocus = function onWindowFocus() {
2193
+ // Execute the timeout only if the file dialog is opened in the browser
2194
+ if (isFileDialogActive) {
2195
+ setTimeout(function () {
2196
+ if (inputRef.current) {
2197
+ var files = inputRef.current.files;
2198
+
2199
+ if (!files.length) {
2200
+ dispatch({
2201
+ type: 'closeDialog'
2202
+ });
2203
+ onFileDialogCancelCb();
2204
+ }
2205
+ }
2206
+ }, 300);
2207
+ }
2208
+ };
2209
+
2210
+ React.useEffect(function () {
2211
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
2212
+ return function () {};
2213
+ }
2214
+
2215
+ window.addEventListener('focus', onWindowFocus, false);
2216
+ return function () {
2217
+ window.removeEventListener('focus', onWindowFocus, false);
2218
+ };
2219
+ }, [inputRef, isFileDialogActive, onFileDialogCancelCb, useFsAccessApi]);
2220
+ var dragTargetsRef = React.useRef([]);
2221
+
2222
+ var onDocumentDrop = function onDocumentDrop(event) {
2223
+ if (rootRef.current && rootRef.current.contains(event.target)) {
2224
+ // If we intercepted an event for our instance, let it propagate down to the instance's onDrop handler
2225
+ return;
2226
+ }
2227
+
2228
+ event.preventDefault();
2229
+ dragTargetsRef.current = [];
2230
+ };
2231
+
2232
+ React.useEffect(function () {
2233
+ if (preventDropOnDocument) {
2234
+ document.addEventListener('dragover', onDocumentDragOver, false);
2235
+ document.addEventListener('drop', onDocumentDrop, false);
2236
+ }
2237
+
2238
+ return function () {
2239
+ if (preventDropOnDocument) {
2240
+ document.removeEventListener('dragover', onDocumentDragOver);
2241
+ document.removeEventListener('drop', onDocumentDrop);
2242
+ }
2243
+ };
2244
+ }, [rootRef, preventDropOnDocument]);
2245
+ var onDragEnterCb = React.useCallback(function (event) {
2246
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
2247
+
2248
+ event.persist();
2249
+ stopPropagation(event);
2250
+ dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
2251
+
2252
+ if (isEvtWithFiles(event)) {
2253
+ Promise.resolve(getFilesFromEvent(event)).then(function (draggedFiles) {
2254
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
2255
+ return;
2256
+ }
2257
+
2258
+ dispatch({
2259
+ draggedFiles: draggedFiles,
2260
+ isDragActive: true,
2261
+ type: 'setDraggedFiles'
2262
+ });
2263
+
2264
+ if (onDragEnter) {
2265
+ onDragEnter(event);
2266
+ }
2267
+ });
2268
+ }
2269
+ }, [getFilesFromEvent, onDragEnter, noDragEventsBubbling]);
2270
+ var onDragOverCb = React.useCallback(function (event) {
2271
+ event.preventDefault();
2272
+ event.persist();
2273
+ stopPropagation(event);
2274
+ var hasFiles = isEvtWithFiles(event);
2275
+
2276
+ if (hasFiles && event.dataTransfer) {
2277
+ try {
2278
+ event.dataTransfer.dropEffect = 'copy';
2279
+ } catch (_unused) {}
2280
+ /* eslint-disable-line no-empty */
2281
+
2282
+ }
2283
+
2284
+ if (hasFiles && onDragOver) {
2285
+ onDragOver(event);
2286
+ }
2287
+
2288
+ return false;
2289
+ }, [onDragOver, noDragEventsBubbling]);
2290
+ var onDragLeaveCb = React.useCallback(function (event) {
2291
+ event.preventDefault();
2292
+ event.persist();
2293
+ stopPropagation(event); // Only deactivate once the dropzone and all children have been left
2294
+
2295
+ var targets = dragTargetsRef.current.filter(function (target) {
2296
+ return rootRef.current && rootRef.current.contains(target);
2297
+ }); // Make sure to remove a target present multiple times only once
2298
+ // (Firefox may fire dragenter/dragleave multiple times on the same element)
2299
+
2300
+ var targetIdx = targets.indexOf(event.target);
2301
+
2302
+ if (targetIdx !== -1) {
2303
+ targets.splice(targetIdx, 1);
2304
+ }
2305
+
2306
+ dragTargetsRef.current = targets;
2307
+
2308
+ if (targets.length > 0) {
2309
+ return;
2310
+ }
2311
+
2312
+ dispatch({
2313
+ isDragActive: false,
2314
+ type: 'setDraggedFiles',
2315
+ draggedFiles: []
2316
+ });
2317
+
2318
+ if (isEvtWithFiles(event) && onDragLeave) {
2319
+ onDragLeave(event);
2320
+ }
2321
+ }, [rootRef, onDragLeave, noDragEventsBubbling]);
2322
+ var setFiles = React.useCallback(function (files, event) {
2323
+ var acceptedFiles = [];
2324
+ var fileRejections = [];
2325
+ files.forEach(function (file) {
2326
+ var _fileAccepted = fileAccepted(file, accept),
2327
+ _fileAccepted2 = _slicedToArray(_fileAccepted, 2),
2328
+ accepted = _fileAccepted2[0],
2329
+ acceptError = _fileAccepted2[1];
2330
+
2331
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize),
2332
+ _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2),
2333
+ sizeMatch = _fileMatchSize2[0],
2334
+ sizeError = _fileMatchSize2[1];
2335
+
2336
+ var customErrors = validator ? validator(file) : null;
2337
+
2338
+ if (accepted && sizeMatch && !customErrors) {
2339
+ acceptedFiles.push(file);
2340
+ } else {
2341
+ var errors = [acceptError, sizeError];
2342
+
2343
+ if (customErrors) {
2344
+ errors = errors.concat(customErrors);
2345
+ }
2346
+
2347
+ fileRejections.push({
2348
+ file: file,
2349
+ errors: errors.filter(function (e) {
2350
+ return e;
2351
+ })
2352
+ });
2353
+ }
2354
+ });
2355
+
2356
+ if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
2357
+ // Reject everything and empty accepted files
2358
+ acceptedFiles.forEach(function (file) {
2359
+ fileRejections.push({
2360
+ file: file,
2361
+ errors: [TOO_MANY_FILES_REJECTION]
2362
+ });
2363
+ });
2364
+ acceptedFiles.splice(0);
2365
+ }
2366
+
2367
+ dispatch({
2368
+ acceptedFiles: acceptedFiles,
2369
+ fileRejections: fileRejections,
2370
+ type: 'setFiles'
2371
+ });
2372
+
2373
+ if (onDrop) {
2374
+ onDrop(acceptedFiles, fileRejections, event);
2375
+ }
2376
+
2377
+ if (fileRejections.length > 0 && onDropRejected) {
2378
+ onDropRejected(fileRejections, event);
2379
+ }
2380
+
2381
+ if (acceptedFiles.length > 0 && onDropAccepted) {
2382
+ onDropAccepted(acceptedFiles, event);
2383
+ }
2384
+ }, [dispatch, multiple, accept, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
2385
+ var onDropCb = React.useCallback(function (event) {
2386
+ event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
2387
+
2388
+ event.persist();
2389
+ stopPropagation(event);
2390
+ dragTargetsRef.current = [];
2391
+
2392
+ if (isEvtWithFiles(event)) {
2393
+ Promise.resolve(getFilesFromEvent(event)).then(function (files) {
2394
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
2395
+ return;
2396
+ }
2397
+
2398
+ setFiles(files, event);
2399
+ });
2400
+ }
2401
+
2402
+ dispatch({
2403
+ type: 'reset'
2404
+ });
2405
+ }, [getFilesFromEvent, setFiles, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
2406
+
2407
+ var openFileDialog = React.useCallback(function () {
2408
+ if (useFsAccessApi && canUseFileSystemAccessAPI()) {
2409
+ dispatch({
2410
+ type: 'openDialog'
2411
+ });
2412
+ onFileDialogOpenCb(); // https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker
2413
+
2414
+ var opts = {
2415
+ multiple: multiple,
2416
+ types: filePickerOptionsTypes(accept)
2417
+ };
2418
+ window.showOpenFilePicker(opts).then(function (handles) {
2419
+ return getFilesFromEvent(handles);
2420
+ }).then(function (files) {
2421
+ return setFiles(files, null);
2422
+ }).catch(function (e) {
2423
+ return onFileDialogCancelCb(e);
2424
+ }).finally(function () {
2425
+ return dispatch({
2426
+ type: 'closeDialog'
2427
+ });
2428
+ });
2429
+ return;
2430
+ }
2431
+
2432
+ if (inputRef.current) {
2433
+ dispatch({
2434
+ type: 'openDialog'
2435
+ });
2436
+ onFileDialogOpenCb();
2437
+ inputRef.current.value = null;
2438
+ inputRef.current.click();
2439
+ }
2440
+ }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, accept, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
2441
+
2442
+ var onKeyDownCb = React.useCallback(function (event) {
2443
+ // Ignore keyboard events bubbling up the DOM tree
2444
+ if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
2445
+ return;
2446
+ }
2447
+
2448
+ if (event.keyCode === 32 || event.keyCode === 13) {
2449
+ event.preventDefault();
2450
+ openFileDialog();
2451
+ }
2452
+ }, [rootRef, inputRef, openFileDialog]); // Update focus state for the dropzone
2453
+
2454
+ var onFocusCb = React.useCallback(function () {
2455
+ dispatch({
2456
+ type: 'focus'
2457
+ });
2458
+ }, []);
2459
+ var onBlurCb = React.useCallback(function () {
2460
+ dispatch({
2461
+ type: 'blur'
2462
+ });
2463
+ }, []); // Cb to open the file dialog when click occurs on the dropzone
2464
+
2465
+ var onClickCb = React.useCallback(function () {
2466
+ if (noClick) {
2467
+ return;
2468
+ } // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
2469
+ // to ensure React can handle state changes
2470
+ // See: https://github.com/react-dropzone/react-dropzone/issues/450
2471
+
2472
+
2473
+ if (isIeOrEdge()) {
2474
+ setTimeout(openFileDialog, 0);
2475
+ } else {
2476
+ openFileDialog();
2477
+ }
2478
+ }, [inputRef, noClick, openFileDialog]);
2479
+
2480
+ var composeHandler = function composeHandler(fn) {
2481
+ return disabled ? null : fn;
2482
+ };
2483
+
2484
+ var composeKeyboardHandler = function composeKeyboardHandler(fn) {
2485
+ return noKeyboard ? null : composeHandler(fn);
2486
+ };
2487
+
2488
+ var composeDragHandler = function composeDragHandler(fn) {
2489
+ return noDrag ? null : composeHandler(fn);
2490
+ };
2491
+
2492
+ var stopPropagation = function stopPropagation(event) {
2493
+ if (noDragEventsBubbling) {
2494
+ event.stopPropagation();
2495
+ }
2496
+ };
2497
+
2498
+ var getRootProps = React.useMemo(function () {
2499
+ return function () {
2500
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2501
+ _ref2$refKey = _ref2.refKey,
2502
+ refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
2503
+ role = _ref2.role,
2504
+ onKeyDown = _ref2.onKeyDown,
2505
+ onFocus = _ref2.onFocus,
2506
+ onBlur = _ref2.onBlur,
2507
+ onClick = _ref2.onClick,
2508
+ onDragEnter = _ref2.onDragEnter,
2509
+ onDragOver = _ref2.onDragOver,
2510
+ onDragLeave = _ref2.onDragLeave,
2511
+ onDrop = _ref2.onDrop,
2512
+ rest = _objectWithoutProperties(_ref2, _excluded3);
2513
+
2514
+ return _objectSpread(_objectSpread(_defineProperty({
2515
+ onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
2516
+ onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
2517
+ onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
2518
+ onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
2519
+ onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter, onDragEnterCb)),
2520
+ onDragOver: composeDragHandler(composeEventHandlers(onDragOver, onDragOverCb)),
2521
+ onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave, onDragLeaveCb)),
2522
+ onDrop: composeDragHandler(composeEventHandlers(onDrop, onDropCb)),
2523
+ role: typeof role === 'string' && role !== '' ? role : 'button'
2524
+ }, refKey, rootRef), !disabled && !noKeyboard ? {
2525
+ tabIndex: 0
2526
+ } : {}), rest);
2527
+ };
2528
+ }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
2529
+ var onInputElementClick = React.useCallback(function (event) {
2530
+ event.stopPropagation();
2531
+ }, []);
2532
+ var getInputProps = React.useMemo(function () {
2533
+ return function () {
2534
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2535
+ _ref3$refKey = _ref3.refKey,
2536
+ refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2537
+ onChange = _ref3.onChange,
2538
+ onClick = _ref3.onClick,
2539
+ rest = _objectWithoutProperties(_ref3, _excluded4);
2540
+
2541
+ var inputProps = _defineProperty({
2542
+ accept: accept,
2543
+ multiple: multiple,
2544
+ type: 'file',
2545
+ style: {
2546
+ display: 'none'
2547
+ },
2548
+ onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
2549
+ onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
2550
+ autoComplete: 'off',
2551
+ tabIndex: -1
2552
+ }, refKey, inputRef);
2553
+
2554
+ return _objectSpread(_objectSpread({}, inputProps), rest);
2555
+ };
2556
+ }, [inputRef, accept, multiple, onDropCb, disabled]);
2557
+ var fileCount = draggedFiles.length;
2558
+ var isDragAccept = fileCount > 0 && allFilesAccepted({
2559
+ files: draggedFiles,
2560
+ accept: accept,
2561
+ minSize: minSize,
2562
+ maxSize: maxSize,
2563
+ multiple: multiple,
2564
+ maxFiles: maxFiles
2565
+ });
2566
+ var isDragReject = fileCount > 0 && !isDragAccept;
2567
+ return _objectSpread(_objectSpread({}, state), {}, {
2568
+ isDragAccept: isDragAccept,
2569
+ isDragReject: isDragReject,
2570
+ isFocused: isFocused && !disabled,
2571
+ getRootProps: getRootProps,
2572
+ getInputProps: getInputProps,
2573
+ rootRef: rootRef,
2574
+ inputRef: inputRef,
2575
+ open: composeHandler(openFileDialog)
2576
+ });
2577
+ }
2578
+
2579
+ function reducer(state, action) {
2580
+ /* istanbul ignore next */
2581
+ switch (action.type) {
2582
+ case 'focus':
2583
+ return _objectSpread(_objectSpread({}, state), {}, {
2584
+ isFocused: true
2585
+ });
2586
+
2587
+ case 'blur':
2588
+ return _objectSpread(_objectSpread({}, state), {}, {
2589
+ isFocused: false
2590
+ });
2591
+
2592
+ case 'openDialog':
2593
+ return _objectSpread(_objectSpread({}, initialState), {}, {
2594
+ isFileDialogActive: true
2595
+ });
2596
+
2597
+ case 'closeDialog':
2598
+ return _objectSpread(_objectSpread({}, state), {}, {
2599
+ isFileDialogActive: false
2600
+ });
2601
+
2602
+ case 'setDraggedFiles':
2603
+ /* eslint no-case-declarations: 0 */
2604
+ var isDragActive = action.isDragActive,
2605
+ draggedFiles = action.draggedFiles;
2606
+ return _objectSpread(_objectSpread({}, state), {}, {
2607
+ draggedFiles: draggedFiles,
2608
+ isDragActive: isDragActive
2609
+ });
2610
+
2611
+ case 'setFiles':
2612
+ return _objectSpread(_objectSpread({}, state), {}, {
2613
+ acceptedFiles: action.acceptedFiles,
2614
+ fileRejections: action.fileRejections
2615
+ });
2616
+
2617
+ case 'reset':
2618
+ return _objectSpread({}, initialState);
2619
+
2620
+ default:
2621
+ return state;
2622
+ }
2623
+ }
2624
+
2625
+ function noop() {}
2626
+
2627
+ var css_248z = ".grljXfTWj84- {\n font-size: 0;\n line-height: 0;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n cursor: pointer;\n}\n\n.grljXfTWj84-:focus,\n.grljXfTWj84-:focus-within {\n border-color: var(--color-focus);\n outline: none;\n}\n\n.WHhHWgaoXk4- {\n padding: var(--space-base);\n border: var(--color-border) dashed var(--border-thick);\n border-radius: var(--radius-larger);\n text-align: center;\n}\n\n.WHhHWgaoXk4-.n1h-T2metRA- {\n border-color: var(--color-focus);\n background-color: var(--color-surface--hover);\n}\n\n.WHhHWgaoXk4-.MRRclAp51-w- {\n border-color: var(--color-critical);\n}\n\n.TIbSRNvDK10- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n";
2628
+ var styles = {"dropZoneBase":"grljXfTWj84-","dropZone":"WHhHWgaoXk4-","active":"n1h-T2metRA-","error":"MRRclAp51-w-","validationErrors":"TIbSRNvDK10-"};
2629
+ styleInject_es.styleInject(css_248z);
2630
+
2631
+ function InputFile({ variation = "dropzone", size = "base", buttonLabel: providedButtonLabel, allowMultiple = false, allowedTypes = "all", getUploadParams, onUploadStart, onUploadProgress, onUploadComplete, onUploadError, validator, }) {
2632
+ const options = {
2633
+ multiple: allowMultiple,
2634
+ onDrop: React.useCallback(handleDrop, [uploadFile]),
2635
+ validator: validator && React.useCallback(validator, []),
2636
+ };
2637
+ if (allowedTypes === "images") {
2638
+ options.accept = "image/*";
2639
+ }
2640
+ else if (allowedTypes === "basicImages") {
2641
+ options.accept = "image/png, image/jpg, image/jpeg";
2642
+ }
2643
+ else if (Array.isArray(allowedTypes)) {
2644
+ options.accept = allowedTypes.join(",");
2645
+ }
2646
+ const { getRootProps, getInputProps, isDragActive, fileRejections } = useDropzone(options);
2647
+ const validationErrors = fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.map(({ file, errors }) => {
2648
+ return errors.map(error => {
2649
+ return (React.createElement(InputValidation.InputValidation, { message: `${file.name} ${error.message}`, key: `${file.name}${error.code}` }));
2650
+ });
2651
+ });
2652
+ const { buttonLabel, hintText } = getLabels(providedButtonLabel, allowMultiple, allowedTypes);
2653
+ const dropZone = classnames(styles.dropZoneBase, {
2654
+ [styles.dropZone]: variation === "dropzone",
2655
+ [styles.active]: isDragActive,
2656
+ [styles.error]: (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0,
2657
+ });
2658
+ return (React.createElement(React.Fragment, null,
2659
+ React.createElement("div", Object.assign({}, getRootProps({ className: dropZone }), { tabIndex: variation === "button" ? -1 : 0 }),
2660
+ React.createElement("input", Object.assign({}, getInputProps())),
2661
+ variation === "dropzone" && (React.createElement(Content.Content, { spacing: "small" },
2662
+ React.createElement(Button.Button, { label: buttonLabel, size: "small", type: "secondary" }),
2663
+ size === "base" && (React.createElement(Typography.Typography, { size: "small", textColor: "textSecondary" }, hintText)))),
2664
+ variation === "button" && (React.createElement(Button.Button, { label: buttonLabel, size: size, type: "secondary", fullWidth: true }))),
2665
+ (fileRejections === null || fileRejections === void 0 ? void 0 : fileRejections.length) > 0 && (React.createElement("div", { className: styles.validationErrors }, validationErrors))));
2666
+ function handleDrop(acceptedFiles) {
2667
+ acceptedFiles.forEach(file => {
2668
+ uploadFile(file);
2669
+ });
2670
+ }
2671
+ function uploadFile(file) {
2672
+ return tslib_es6.__awaiter(this, void 0, void 0, function* () {
2673
+ let params;
2674
+ try {
2675
+ params = yield getUploadParams(file);
2676
+ }
2677
+ catch (_a) {
2678
+ onUploadError && onUploadError(new Error("Failed to get upload params"));
2679
+ return;
2680
+ }
2681
+ const { url, key = generateId(), fields = {}, httpMethod = "POST", } = params;
2682
+ const fileUpload = getFileUpload(file, key, url);
2683
+ onUploadStart && onUploadStart(Object.assign({}, fileUpload));
2684
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2685
+ const handleUploadProgress = (progressEvent) => {
2686
+ onUploadProgress &&
2687
+ onUploadProgress(Object.assign(Object.assign({}, fileUpload), { progress: progressEvent.loaded / progressEvent.total }));
2688
+ };
2689
+ const handleUploadComplete = () => {
2690
+ onUploadComplete === null || onUploadComplete === void 0 ? void 0 : onUploadComplete(Object.assign(Object.assign({}, fileUpload), { progress: 1 }));
2691
+ };
2692
+ const axiosConfig = createAxiosConfig({
2693
+ url,
2694
+ httpMethod,
2695
+ fields,
2696
+ file,
2697
+ handleUploadProgress,
2698
+ });
2699
+ axios
2700
+ .request(axiosConfig)
2701
+ .then(handleUploadComplete)
2702
+ .catch(() => {
2703
+ onUploadError && onUploadError(new Error("Failed to upload file"));
2704
+ });
2705
+ });
2706
+ }
2707
+ }
2708
+ function createAxiosConfig({ url, httpMethod = "POST", fields = {}, file, handleUploadProgress, }) {
2709
+ let data;
2710
+ let headers;
2711
+ if (httpMethod === "POST") {
2712
+ const formData = new FormData();
2713
+ Object.entries(fields).forEach(([field, value]) => formData.append(field, value));
2714
+ formData.append("file", file);
2715
+ data = formData;
2716
+ headers = { "X-Requested-With": "XMLHttpRequest" };
2717
+ }
2718
+ else {
2719
+ data = file;
2720
+ headers = fields;
2721
+ }
2722
+ return {
2723
+ method: httpMethod,
2724
+ url: url,
2725
+ headers: headers,
2726
+ data: data,
2727
+ onUploadProgress: handleUploadProgress,
2728
+ };
2729
+ }
2730
+ function getLabels(providedButtonLabel, multiple, allowedTypes) {
2731
+ let buttonLabel = multiple ? "Upload Files" : "Upload File";
2732
+ let hintText = multiple
2733
+ ? "or drag files here to upload"
2734
+ : "or drag a file here to upload";
2735
+ if (allowedTypes === "images" || allowedTypes === "basicImages") {
2736
+ buttonLabel = multiple ? "Upload Images" : "Upload Image";
2737
+ hintText = multiple
2738
+ ? "or drag images here to upload"
2739
+ : "or drag an image here to upload";
2740
+ }
2741
+ if (providedButtonLabel)
2742
+ buttonLabel = providedButtonLabel;
2743
+ return { buttonLabel, hintText };
2744
+ }
2745
+ function getFileUpload(file, key, uploadUrl) {
2746
+ return {
2747
+ key: key,
2748
+ name: file.name,
2749
+ type: file.type,
2750
+ size: file.size,
2751
+ progress: 0,
2752
+ src: getSrc,
2753
+ uploadUrl,
2754
+ };
2755
+ function getSrc() {
2756
+ const promise = new Promise((resolve, reject) => {
2757
+ const reader = new FileReader();
2758
+ reader.onload = event => {
2759
+ if (event.target &&
2760
+ event.target.result &&
2761
+ typeof event.target.result === "string") {
2762
+ resolve(event.target.result);
2763
+ }
2764
+ else {
2765
+ reject("Could not generate file data url.");
2766
+ }
2767
+ };
2768
+ reader.readAsDataURL(file);
2769
+ });
2770
+ return promise;
2771
+ }
2772
+ }
2773
+ /**
2774
+ * Upsert a given `FileUpload` into an array of `FileUpload`s.
2775
+ * `key` is used to uniquely identify files.
2776
+ *
2777
+ * @param updatedFile FileUpload File that was updated.
2778
+ * @param files Existing array of FileUploads.
2779
+ * @returns FileUpload[] updated set of files.
2780
+ */
2781
+ function updateFiles(updatedFile, files) {
2782
+ const newFiles = [...files];
2783
+ const index = files.findIndex(file => file.key === updatedFile.key);
2784
+ if (index !== -1) {
2785
+ newFiles[index] = updatedFile;
2786
+ }
2787
+ else {
2788
+ newFiles.push(updatedFile);
2789
+ }
2790
+ return newFiles;
2791
+ }
2792
+ function generateId() {
2793
+ return Math.floor(Math.random() * Date.now()).toString(16);
2794
+ }
2795
+
2796
+ exports.InputFile = InputFile;
2797
+ exports.updateFiles = updateFiles;