@bigbinary/neeto-molecules 1.1.10 → 1.1.11

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 (474) hide show
  1. package/dist/AutoSaveInput/autosaveinput.scss +15 -0
  2. package/dist/AutoSaveInput/constants.js +13 -0
  3. package/dist/AutoSaveInput/index.js +124 -0
  4. package/dist/AutoSaveInput/utils.js +10 -0
  5. package/dist/Breadcrumbs/breadcrumbs.scss +33 -0
  6. package/dist/Breadcrumbs/index.js +31 -0
  7. package/dist/BrowserSupport/Callout.js +15 -0
  8. package/dist/BrowserSupport/ContactUs.js +21 -0
  9. package/dist/BrowserSupport/DownloadLink.js +17 -0
  10. package/dist/BrowserSupport/PartialSupportedBrowserVersion.js +17 -0
  11. package/dist/BrowserSupport/UnknownBrowser.js +13 -0
  12. package/dist/BrowserSupport/UnsupportedBrowser.js +24 -0
  13. package/dist/BrowserSupport/UnsupportedBrowserMessage.js +22 -0
  14. package/dist/BrowserSupport/UnsupportedBrowserVersion.js +27 -0
  15. package/dist/BrowserSupport/UnsupportedVersionMessage.js +30 -0
  16. package/dist/BrowserSupport/browsersupport.scss +71 -0
  17. package/dist/BrowserSupport/constants.js +63 -0
  18. package/dist/BrowserSupport/index.js +58 -0
  19. package/dist/BrowserSupport/utils.js +32 -0
  20. package/dist/CalendarView/CustomDatePicker.js +87 -0
  21. package/dist/CalendarView/Header.js +53 -0
  22. package/dist/CalendarView/constants.js +19 -0
  23. package/dist/CalendarView/index.js +83 -0
  24. package/dist/CalendarView/utils.js +50 -0
  25. package/dist/Codeblock/index.js +30 -0
  26. package/dist/{Columns.js → Columns/index.js} +13 -130
  27. package/dist/Columns/utils.js +20 -0
  28. package/dist/ConfirmationModal/constants.js +3 -0
  29. package/dist/{ConfirmationModal.js → ConfirmationModal/index.js} +7 -23
  30. package/dist/ConfirmationModal/utils.js +10 -0
  31. package/dist/Container/container.scss +21 -0
  32. package/dist/Container/index.js +23 -0
  33. package/dist/CopyToClipboardButton/constants.js +13 -0
  34. package/dist/CopyToClipboardButton/copyToClipboard.scss +22 -0
  35. package/dist/CopyToClipboardButton/index.js +59 -0
  36. package/dist/CustomDomain/index.js +98 -0
  37. package/dist/CustomDomainDashboard/DeleteAlert.js +28 -0
  38. package/dist/CustomDomainDashboard/Header.js +32 -0
  39. package/dist/CustomDomainDashboard/Manage/Record.js +42 -0
  40. package/dist/CustomDomainDashboard/Manage/StatusInfo.js +21 -0
  41. package/dist/CustomDomainDashboard/Manage/TagBlock.js +36 -0
  42. package/dist/CustomDomainDashboard/Manage/constants.js +4 -0
  43. package/dist/CustomDomainDashboard/Manage/index.js +124 -0
  44. package/dist/CustomDomainDashboard/Manage/utils.js +8 -0
  45. package/dist/CustomDomainDashboard/api.js +35 -0
  46. package/dist/CustomDomainDashboard/constants.js +2 -0
  47. package/dist/CustomDomainDashboard/index.js +118 -0
  48. package/dist/CustomDomainDashboard/useCustomDomainApi.js +71 -0
  49. package/dist/CustomDomainDashboard/utils.js +84 -0
  50. package/dist/{DateFormat.js → DateFormat/index.js} +8 -25
  51. package/dist/DateRangeFilter/index.js +60 -0
  52. package/dist/DateRangeFilter/utils.js +113 -0
  53. package/dist/DynamicVariables/dynamic-variables.scss +34 -0
  54. package/dist/DynamicVariables/index.js +59 -0
  55. package/dist/DynamicVariables/utils.js +37 -0
  56. package/dist/EmailForm/EmailForm.js +97 -0
  57. package/dist/EmailForm/EmailFormProvider.js +45 -0
  58. package/dist/EmailForm/EmailPreview.js +129 -0
  59. package/dist/EmailForm/ReplyToField.js +55 -0
  60. package/dist/EmailForm/SendToField.js +27 -0
  61. package/dist/EmailForm/SubjectField.js +64 -0
  62. package/dist/EmailForm/constants.js +33 -0
  63. package/dist/EmailForm/contexts/EmailForm.js +7 -0
  64. package/dist/EmailForm/index.js +4 -0
  65. package/dist/EmailForm/utils.js +10 -0
  66. package/dist/EmailPreview/index.js +2 -0
  67. package/dist/{ErrorPage.js → ErrorPage/constants.js} +36 -175
  68. package/dist/ErrorPage/index.js +78 -0
  69. package/dist/Header/Breadcrumbs.js +31 -0
  70. package/dist/Header/Dropdown.js +12 -0
  71. package/dist/Header/constants.js +6 -0
  72. package/dist/Header/header.scss +121 -0
  73. package/dist/Header/index.js +61 -0
  74. package/dist/IconPicker/Icon.js +34 -0
  75. package/dist/IconPicker/NoResults.js +12 -0
  76. package/dist/IconPicker/constants.js +8 -0
  77. package/dist/IconPicker/icon-picker.scss +1 -0
  78. package/dist/IconPicker/index.js +164 -0
  79. package/dist/ImageWithFallback/ImagePlaceholder.js +16 -0
  80. package/dist/ImageWithFallback/index.js +31 -0
  81. package/dist/IntegrationCard/Dropdown.js +45 -0
  82. package/dist/IntegrationCard/Status.js +25 -0
  83. package/dist/IntegrationCard/index.js +128 -0
  84. package/dist/IntegrationDisconnectAlert/index.js +36 -0
  85. package/dist/{IntegrationWalkthroughModal.js → IntegrationWalkthroughModal/index.js} +6 -8
  86. package/dist/IpRestriction/AllowedIpRanges.js +72 -0
  87. package/dist/IpRestriction/CurrentIp.js +26 -0
  88. package/dist/IpRestriction/FormRow.js +77 -0
  89. package/dist/IpRestriction/Row.js +86 -0
  90. package/dist/IpRestriction/apis/allowed_ip_ranges.js +28 -0
  91. package/dist/IpRestriction/apis/current_ip.js +11 -0
  92. package/dist/IpRestriction/apis/ip_restriction.js +16 -0
  93. package/dist/IpRestriction/constants.js +11 -0
  94. package/dist/IpRestriction/hooks/reactQuery/useAllowedIpRanges.js +34 -0
  95. package/dist/IpRestriction/hooks/reactQuery/useCurrentIp.js +10 -0
  96. package/dist/IpRestriction/hooks/reactQuery/useIpRestrictions.js +18 -0
  97. package/dist/IpRestriction/index.js +102 -0
  98. package/dist/IpRestriction/utils.js +67 -0
  99. package/dist/KeyboardShortcuts/Pane/HotKey.js +44 -0
  100. package/dist/KeyboardShortcuts/Pane/HotKeyList.js +42 -0
  101. package/dist/KeyboardShortcuts/Pane/constants.js +25 -0
  102. package/dist/KeyboardShortcuts/Pane/index.js +61 -0
  103. package/dist/KeyboardShortcuts/Pane/keyboard-shortcuts.scss +5 -0
  104. package/dist/KeyboardShortcuts/Pane/utils.js +66 -0
  105. package/dist/KeyboardShortcuts/hooks/useKeyboardShortcutsPaneState.js +31 -0
  106. package/dist/KeyboardShortcuts/index.js +9 -0
  107. package/dist/LoginPage/Form.js +57 -0
  108. package/dist/LoginPage/constants.js +12 -0
  109. package/dist/LoginPage/index.js +103 -0
  110. package/dist/MenuBar/AddNew.js +25 -0
  111. package/dist/MenuBar/Block.js +60 -0
  112. package/dist/MenuBar/Item.js +32 -0
  113. package/dist/MenuBar/Search.js +39 -0
  114. package/dist/MenuBar/SubTitle.js +23 -0
  115. package/dist/MenuBar/index.js +46 -0
  116. package/dist/MenuBar/menubar.scss +154 -0
  117. package/dist/Metadata/Block.js +30 -0
  118. package/dist/Metadata/DetailsBlock.js +86 -0
  119. package/dist/Metadata/constants.js +9 -0
  120. package/dist/Metadata/index.js +29 -0
  121. package/dist/Metadata/metadata.scss +15 -0
  122. package/dist/MoreDropdown/constants.js +25 -0
  123. package/dist/{MoreDropdown.js → MoreDropdown/index.js} +9 -102
  124. package/dist/NavigationHeader/LeftBlock.js +32 -0
  125. package/dist/NavigationHeader/Navigation.js +24 -0
  126. package/dist/NavigationHeader/RightBlock.js +68 -0
  127. package/dist/NavigationHeader/constants.js +11 -0
  128. package/dist/NavigationHeader/index.js +19 -0
  129. package/dist/NavigationHeader/navigation-header.scss +3 -0
  130. package/dist/NeetoWidget/CodeBlock.js +57 -0
  131. package/dist/NeetoWidget/CodeSnippet.js +119 -0
  132. package/dist/NeetoWidget/EmbedCode.js +281 -0
  133. package/dist/NeetoWidget/Main.js +19 -0
  134. package/dist/NeetoWidget/SelectionSwitches/TooltipSwitch.js +25 -0
  135. package/dist/NeetoWidget/SelectionSwitches/index.js +44 -0
  136. package/dist/NeetoWidget/SyntaxHighlighter.js +17 -0
  137. package/dist/NeetoWidget/api.js +20 -0
  138. package/dist/NeetoWidget/constants.js +62 -0
  139. package/dist/NeetoWidget/hooks/useForceUpdate.js +14 -0
  140. package/dist/NeetoWidget/index.js +7 -0
  141. package/dist/NeetoWidget/mutations.js +9 -0
  142. package/dist/NeetoWidget/queries.js +32 -0
  143. package/dist/NeetoWidget/utils.js +83 -0
  144. package/dist/PageLoader/index.js +81 -0
  145. package/dist/PageLoader/page-loader.scss +95 -0
  146. package/dist/PhoneNumber/CountryPicker/SingleValue.js +21 -0
  147. package/dist/PhoneNumber/CountryPicker/constants.js +26 -0
  148. package/dist/PhoneNumber/CountryPicker/index.js +59 -0
  149. package/dist/PhoneNumber/FormikPhoneNumberInput.js +21 -0
  150. package/dist/PhoneNumber/PhoneNumber.js +30 -0
  151. package/dist/PhoneNumber/PhoneNumberInput.js +79 -0
  152. package/dist/PhoneNumber/index.js +5 -0
  153. package/dist/PhoneNumber/utils.js +55 -0
  154. package/dist/PublishBlock/AlertBlock.js +14 -0
  155. package/dist/PublishBlock/index.js +100 -0
  156. package/dist/PublishBlock/publish-block.scss +25 -0
  157. package/dist/Rename/DummySpan.js +21 -0
  158. package/dist/Rename/constants.js +1 -0
  159. package/dist/Rename/index.js +191 -0
  160. package/dist/Rename/rename.scss +69 -0
  161. package/dist/Rename/utils.js +10 -0
  162. package/dist/ResponsiveDevicePicker/constants.js +19 -0
  163. package/dist/ResponsiveDevicePicker/index.js +36 -0
  164. package/dist/Schedule/DisplayAvailability.js +58 -0
  165. package/dist/Schedule/Fields.js +43 -0
  166. package/dist/Schedule/Form/ScheduleRow.js +125 -0
  167. package/dist/Schedule/Form/constants.js +20 -0
  168. package/dist/Schedule/Form/index.js +144 -0
  169. package/dist/Schedule/Form/utils.js +63 -0
  170. package/dist/Schedule/Header.js +76 -0
  171. package/dist/Schedule/ScheduleContext.js +8 -0
  172. package/dist/Schedule/constants.js +8 -0
  173. package/dist/Schedule/dayjsExtended/constants.js +1 -0
  174. package/dist/Schedule/dayjsExtended/index.js +14 -0
  175. package/dist/Schedule/dayjsExtended/range.js +73 -0
  176. package/dist/Schedule/index.js +80 -0
  177. package/dist/Schedule/utils.js +152 -0
  178. package/dist/Scrollable/constants.js +8 -0
  179. package/dist/Scrollable/index.js +26 -0
  180. package/dist/Scrollable/scrollable.scss +32 -0
  181. package/dist/Security/AllowedKeywords/Add.js +38 -0
  182. package/dist/Security/AllowedKeywords/index.js +38 -0
  183. package/dist/Security/PasswordBlock.js +31 -0
  184. package/dist/Security/RadioBlock.js +38 -0
  185. package/dist/Security/api.js +12 -0
  186. package/dist/Security/constants.js +58 -0
  187. package/dist/Security/index.js +68 -0
  188. package/dist/Security/useSecurityApi.js +22 -0
  189. package/dist/Security/utils.js +31 -0
  190. package/dist/SendToFields/FilePicker.js +34 -0
  191. package/dist/SendToFields/constants.js +6 -0
  192. package/dist/SendToFields/index.js +102 -0
  193. package/dist/SendToFields/utils.js +54 -0
  194. package/dist/Settings/Category.js +30 -0
  195. package/dist/Settings/Item.js +38 -0
  196. package/dist/Settings/index.js +37 -0
  197. package/dist/Settings/utils.js +4 -0
  198. package/dist/ShareViaEmail/EmailBodyEditor.js +22 -0
  199. package/dist/ShareViaEmail/FilePicker.js +43 -0
  200. package/dist/ShareViaEmail/Form.js +101 -0
  201. package/dist/ShareViaEmail/FormikDatePicker.js +24 -0
  202. package/dist/ShareViaEmail/constants.js +14 -0
  203. package/dist/ShareViaEmail/index.js +89 -0
  204. package/dist/ShareViaEmail/utils.js +72 -0
  205. package/dist/ShareViaLink/EditURL.js +74 -0
  206. package/dist/ShareViaLink/Link.js +105 -0
  207. package/dist/ShareViaLink/QRCode.js +41 -0
  208. package/dist/ShareViaLink/RegenerateURL.js +47 -0
  209. package/dist/ShareViaLink/SocialMedia.js +52 -0
  210. package/dist/ShareViaLink/constants.js +25 -0
  211. package/dist/ShareViaLink/edit-url.scss +8 -0
  212. package/dist/ShareViaLink/index.js +46 -0
  213. package/dist/ShareViaLink/utils.js +47 -0
  214. package/dist/Sidebar/AppSwitcher/AppLink.js +45 -0
  215. package/dist/Sidebar/AppSwitcher/Backdrop.js +13 -0
  216. package/dist/Sidebar/AppSwitcher/Body.js +65 -0
  217. package/dist/Sidebar/AppSwitcher/Portal.js +27 -0
  218. package/dist/Sidebar/AppSwitcher/appswitcher.scss +164 -0
  219. package/dist/Sidebar/AppSwitcher/index.js +47 -0
  220. package/dist/Sidebar/AppSwitcher/utils.js +25 -0
  221. package/dist/Sidebar/Chevron.js +14 -0
  222. package/dist/Sidebar/FeaturedTooltip.js +19 -0
  223. package/dist/Sidebar/Footer/AppSwitcherButton.js +48 -0
  224. package/dist/Sidebar/Footer/ProfileButton.js +30 -0
  225. package/dist/Sidebar/Footer/index.js +56 -0
  226. package/dist/Sidebar/Footer/utils.js +39 -0
  227. package/dist/Sidebar/Header.js +33 -0
  228. package/dist/Sidebar/HelpSection/HelpSectionMenu.js +52 -0
  229. package/dist/Sidebar/HelpSection/index.js +32 -0
  230. package/dist/Sidebar/Links.js +112 -0
  231. package/dist/Sidebar/NavIconWrapper.js +20 -0
  232. package/dist/Sidebar/ProfileSection/LinkSection.js +36 -0
  233. package/dist/Sidebar/ProfileSection/ProfileMenu.js +48 -0
  234. package/dist/Sidebar/ProfileSection/index.js +42 -0
  235. package/dist/Sidebar/constants.js +40 -0
  236. package/dist/Sidebar/index.js +94 -0
  237. package/dist/Sidebar/sidebar.scss +379 -0
  238. package/dist/Sidebar/utils.js +18 -0
  239. package/dist/SubHeader/RightBlock/Columns.js +35 -0
  240. package/dist/SubHeader/RightBlock/Download.js +28 -0
  241. package/dist/SubHeader/RightBlock/Filter.js +31 -0
  242. package/dist/SubHeader/RightBlock/index.js +21 -0
  243. package/dist/SubHeader/RightBlock/utils.js +13 -0
  244. package/dist/SubHeader/index.js +28 -0
  245. package/dist/SubHeader/subheader.scss +78 -0
  246. package/dist/TableWrapper/index.js +18 -0
  247. package/dist/ThemeSidebar/Customize/Logo.js +39 -0
  248. package/dist/ThemeSidebar/Customize/Properties.js +170 -0
  249. package/dist/ThemeSidebar/Customize/index.js +66 -0
  250. package/dist/ThemeSidebar/Themes/ThemeCard.js +135 -0
  251. package/dist/ThemeSidebar/Themes/index.js +110 -0
  252. package/dist/ThemeSidebar/TitleBar.js +62 -0
  253. package/dist/ThemeSidebar/constants.js +127 -0
  254. package/dist/ThemeSidebar/fields/AlignmentBlock.js +50 -0
  255. package/dist/ThemeSidebar/fields/Card.js +19 -0
  256. package/dist/ThemeSidebar/fields/ColorBlock.js +19 -0
  257. package/dist/ThemeSidebar/fields/FontPickerBlock.js +35 -0
  258. package/dist/ThemeSidebar/fields/ImageBlock/ImageUploader.js +67 -0
  259. package/dist/ThemeSidebar/fields/ImageBlock/ProgressBar.js +22 -0
  260. package/dist/ThemeSidebar/fields/ImageBlock/index.js +55 -0
  261. package/dist/ThemeSidebar/fields/SelectBlock.js +24 -0
  262. package/dist/ThemeSidebar/fields/SliderBlock.js +30 -0
  263. package/dist/ThemeSidebar/fields/SwitchBlock.js +17 -0
  264. package/dist/ThemeSidebar/fields/TextBlock.js +13 -0
  265. package/dist/ThemeSidebar/fields/slider.scss +199 -0
  266. package/dist/ThemeSidebar/hooks/useDirectUploadDropzone.js +149 -0
  267. package/dist/ThemeSidebar/index.js +118 -0
  268. package/dist/ThemeSidebar/themeSidebar.scss +45 -0
  269. package/dist/ThemeSidebar/utils.js +169 -0
  270. package/dist/TimeFormat/index.js +3 -0
  271. package/dist/TimezoneMismatchModal/apis/time_zone.js +9 -0
  272. package/dist/TimezoneMismatchModal/index.js +83 -0
  273. package/dist/TimezoneMismatchModal/useTimeZoneApi.js +10 -0
  274. package/dist/TimezoneMismatchModal/utils.js +12 -0
  275. package/dist/ToggleFeatureCard/ToolTipSwitch.js +31 -0
  276. package/dist/ToggleFeatureCard/constants.js +5 -0
  277. package/dist/ToggleFeatureCard/hooks/useScrollIntoView.js +11 -0
  278. package/dist/ToggleFeatureCard/index.js +148 -0
  279. package/dist/ToggleFeatureCard/toggleFeatureCard.scss +4 -0
  280. package/package.json +27 -34
  281. package/dist/AutoSaveInput.cjs.js +0 -724
  282. package/dist/AutoSaveInput.cjs.js.map +0 -1
  283. package/dist/AutoSaveInput.js +0 -718
  284. package/dist/AutoSaveInput.js.map +0 -1
  285. package/dist/Breadcrumbs.cjs.js +0 -44
  286. package/dist/Breadcrumbs.cjs.js.map +0 -1
  287. package/dist/Breadcrumbs.js +0 -38
  288. package/dist/Breadcrumbs.js.map +0 -1
  289. package/dist/BrowserSupport.cjs.js +0 -1731
  290. package/dist/BrowserSupport.cjs.js.map +0 -1
  291. package/dist/BrowserSupport.js +0 -1725
  292. package/dist/BrowserSupport.js.map +0 -1
  293. package/dist/CalendarView.cjs.js +0 -610
  294. package/dist/CalendarView.cjs.js.map +0 -1
  295. package/dist/CalendarView.js +0 -598
  296. package/dist/CalendarView.js.map +0 -1
  297. package/dist/Codeblock.cjs.js +0 -302
  298. package/dist/Codeblock.cjs.js.map +0 -1
  299. package/dist/Codeblock.js +0 -296
  300. package/dist/Codeblock.js.map +0 -1
  301. package/dist/Columns.cjs.js +0 -248
  302. package/dist/Columns.cjs.js.map +0 -1
  303. package/dist/Columns.js.map +0 -1
  304. package/dist/ConfirmationModal.cjs.js +0 -87
  305. package/dist/ConfirmationModal.cjs.js.map +0 -1
  306. package/dist/ConfirmationModal.js.map +0 -1
  307. package/dist/Container.cjs.js +0 -1277
  308. package/dist/Container.cjs.js.map +0 -1
  309. package/dist/Container.js +0 -1271
  310. package/dist/Container.js.map +0 -1
  311. package/dist/CopyToClipboardButton.cjs.js +0 -275
  312. package/dist/CopyToClipboardButton.cjs.js.map +0 -1
  313. package/dist/CopyToClipboardButton.js +0 -269
  314. package/dist/CopyToClipboardButton.js.map +0 -1
  315. package/dist/CustomDomain.cjs.js +0 -774
  316. package/dist/CustomDomain.cjs.js.map +0 -1
  317. package/dist/CustomDomain.js +0 -747
  318. package/dist/CustomDomain.js.map +0 -1
  319. package/dist/CustomDomainDashboard.cjs.js +0 -2370
  320. package/dist/CustomDomainDashboard.cjs.js.map +0 -1
  321. package/dist/CustomDomainDashboard.js +0 -2342
  322. package/dist/CustomDomainDashboard.js.map +0 -1
  323. package/dist/DateFormat.cjs.js +0 -51
  324. package/dist/DateFormat.cjs.js.map +0 -1
  325. package/dist/DateFormat.js.map +0 -1
  326. package/dist/DateRangeFilter.cjs.js +0 -236
  327. package/dist/DateRangeFilter.cjs.js.map +0 -1
  328. package/dist/DateRangeFilter.js +0 -229
  329. package/dist/DateRangeFilter.js.map +0 -1
  330. package/dist/DynamicVariables.cjs.js +0 -189
  331. package/dist/DynamicVariables.cjs.js.map +0 -1
  332. package/dist/DynamicVariables.js +0 -183
  333. package/dist/DynamicVariables.js.map +0 -1
  334. package/dist/EmailForm.cjs.js +0 -4295
  335. package/dist/EmailForm.cjs.js.map +0 -1
  336. package/dist/EmailForm.js +0 -4265
  337. package/dist/EmailForm.js.map +0 -1
  338. package/dist/EmailPreview.cjs.js +0 -1419
  339. package/dist/EmailPreview.cjs.js.map +0 -1
  340. package/dist/EmailPreview.js +0 -1413
  341. package/dist/EmailPreview.js.map +0 -1
  342. package/dist/ErrorPage.cjs.js +0 -226
  343. package/dist/ErrorPage.cjs.js.map +0 -1
  344. package/dist/ErrorPage.js.map +0 -1
  345. package/dist/Header.cjs.js +0 -188
  346. package/dist/Header.cjs.js.map +0 -1
  347. package/dist/Header.js +0 -182
  348. package/dist/Header.js.map +0 -1
  349. package/dist/IconPicker.cjs.js +0 -1308
  350. package/dist/IconPicker.cjs.js.map +0 -1
  351. package/dist/IconPicker.js +0 -1302
  352. package/dist/IconPicker.js.map +0 -1
  353. package/dist/ImageWithFallback.cjs.js +0 -247
  354. package/dist/ImageWithFallback.cjs.js.map +0 -1
  355. package/dist/ImageWithFallback.js +0 -241
  356. package/dist/ImageWithFallback.js.map +0 -1
  357. package/dist/IntegrationCard.cjs.js +0 -409
  358. package/dist/IntegrationCard.cjs.js.map +0 -1
  359. package/dist/IntegrationCard.js +0 -403
  360. package/dist/IntegrationCard.js.map +0 -1
  361. package/dist/IntegrationDisconnectAlert.cjs.js +0 -89
  362. package/dist/IntegrationDisconnectAlert.cjs.js.map +0 -1
  363. package/dist/IntegrationDisconnectAlert.js +0 -80
  364. package/dist/IntegrationDisconnectAlert.js.map +0 -1
  365. package/dist/IntegrationWalkthroughModal.cjs.js +0 -50
  366. package/dist/IntegrationWalkthroughModal.cjs.js.map +0 -1
  367. package/dist/IntegrationWalkthroughModal.js.map +0 -1
  368. package/dist/IpRestriction.cjs.js +0 -3931
  369. package/dist/IpRestriction.cjs.js.map +0 -1
  370. package/dist/IpRestriction.js +0 -3905
  371. package/dist/IpRestriction.js.map +0 -1
  372. package/dist/KeyboardShortcuts.cjs.js +0 -2263
  373. package/dist/KeyboardShortcuts.cjs.js.map +0 -1
  374. package/dist/KeyboardShortcuts.js +0 -2256
  375. package/dist/KeyboardShortcuts.js.map +0 -1
  376. package/dist/LoginPage.cjs.js +0 -618
  377. package/dist/LoginPage.cjs.js.map +0 -1
  378. package/dist/LoginPage.js +0 -593
  379. package/dist/LoginPage.js.map +0 -1
  380. package/dist/MenuBar.cjs.js +0 -34273
  381. package/dist/MenuBar.cjs.js.map +0 -1
  382. package/dist/MenuBar.js +0 -34267
  383. package/dist/MenuBar.js.map +0 -1
  384. package/dist/Metadata.cjs.js +0 -272
  385. package/dist/Metadata.cjs.js.map +0 -1
  386. package/dist/Metadata.js +0 -266
  387. package/dist/Metadata.js.map +0 -1
  388. package/dist/MoreDropdown.cjs.js +0 -168
  389. package/dist/MoreDropdown.cjs.js.map +0 -1
  390. package/dist/MoreDropdown.js.map +0 -1
  391. package/dist/NavigationHeader.cjs.js +0 -756
  392. package/dist/NavigationHeader.cjs.js.map +0 -1
  393. package/dist/NavigationHeader.js +0 -750
  394. package/dist/NavigationHeader.js.map +0 -1
  395. package/dist/NeetoWidget.cjs.js +0 -3375
  396. package/dist/NeetoWidget.cjs.js.map +0 -1
  397. package/dist/NeetoWidget.js +0 -3348
  398. package/dist/NeetoWidget.js.map +0 -1
  399. package/dist/PageLoader.cjs.js +0 -158
  400. package/dist/PageLoader.cjs.js.map +0 -1
  401. package/dist/PageLoader.js +0 -134
  402. package/dist/PageLoader.js.map +0 -1
  403. package/dist/PhoneNumber.cjs.js +0 -7021
  404. package/dist/PhoneNumber.cjs.js.map +0 -1
  405. package/dist/PhoneNumber.js +0 -6989
  406. package/dist/PhoneNumber.js.map +0 -1
  407. package/dist/PublishBlock.cjs.js +0 -224
  408. package/dist/PublishBlock.cjs.js.map +0 -1
  409. package/dist/PublishBlock.js +0 -218
  410. package/dist/PublishBlock.js.map +0 -1
  411. package/dist/Rename.cjs.js +0 -516
  412. package/dist/Rename.cjs.js.map +0 -1
  413. package/dist/Rename.js +0 -510
  414. package/dist/Rename.js.map +0 -1
  415. package/dist/ResponsiveDevicePicker.cjs.js +0 -260
  416. package/dist/ResponsiveDevicePicker.cjs.js.map +0 -1
  417. package/dist/ResponsiveDevicePicker.js +0 -254
  418. package/dist/ResponsiveDevicePicker.js.map +0 -1
  419. package/dist/Schedule.cjs.js +0 -1077
  420. package/dist/Schedule.cjs.js.map +0 -1
  421. package/dist/Schedule.js +0 -1046
  422. package/dist/Schedule.js.map +0 -1
  423. package/dist/Scrollable.cjs.js +0 -188
  424. package/dist/Scrollable.cjs.js.map +0 -1
  425. package/dist/Scrollable.js +0 -182
  426. package/dist/Scrollable.js.map +0 -1
  427. package/dist/Security.cjs.js +0 -1921
  428. package/dist/Security.cjs.js.map +0 -1
  429. package/dist/Security.js +0 -1895
  430. package/dist/Security.js.map +0 -1
  431. package/dist/SendToFields.cjs.js +0 -2524
  432. package/dist/SendToFields.cjs.js.map +0 -1
  433. package/dist/SendToFields.js +0 -2517
  434. package/dist/SendToFields.js.map +0 -1
  435. package/dist/Settings.cjs.js +0 -501
  436. package/dist/Settings.cjs.js.map +0 -1
  437. package/dist/Settings.js +0 -495
  438. package/dist/Settings.js.map +0 -1
  439. package/dist/ShareViaEmail.cjs.js +0 -4272
  440. package/dist/ShareViaEmail.cjs.js.map +0 -1
  441. package/dist/ShareViaEmail.js +0 -4246
  442. package/dist/ShareViaEmail.js.map +0 -1
  443. package/dist/ShareViaLink.cjs.js +0 -1512
  444. package/dist/ShareViaLink.cjs.js.map +0 -1
  445. package/dist/ShareViaLink.js +0 -1486
  446. package/dist/ShareViaLink.js.map +0 -1
  447. package/dist/Sidebar.cjs.js +0 -34985
  448. package/dist/Sidebar.cjs.js.map +0 -1
  449. package/dist/Sidebar.js +0 -34959
  450. package/dist/Sidebar.js.map +0 -1
  451. package/dist/SubHeader.cjs.js +0 -283
  452. package/dist/SubHeader.cjs.js.map +0 -1
  453. package/dist/SubHeader.js +0 -276
  454. package/dist/SubHeader.js.map +0 -1
  455. package/dist/TableWrapper.cjs.js +0 -87
  456. package/dist/TableWrapper.cjs.js.map +0 -1
  457. package/dist/TableWrapper.js +0 -81
  458. package/dist/TableWrapper.js.map +0 -1
  459. package/dist/ThemeSidebar.cjs.js +0 -13705
  460. package/dist/ThemeSidebar.cjs.js.map +0 -1
  461. package/dist/ThemeSidebar.js +0 -13680
  462. package/dist/ThemeSidebar.js.map +0 -1
  463. package/dist/TimeFormat.cjs.js +0 -53
  464. package/dist/TimeFormat.cjs.js.map +0 -1
  465. package/dist/TimeFormat.js +0 -47
  466. package/dist/TimeFormat.js.map +0 -1
  467. package/dist/TimezoneMismatchModal.cjs.js +0 -176
  468. package/dist/TimezoneMismatchModal.cjs.js.map +0 -1
  469. package/dist/TimezoneMismatchModal.js +0 -168
  470. package/dist/TimezoneMismatchModal.js.map +0 -1
  471. package/dist/ToggleFeatureCard.cjs.js +0 -389
  472. package/dist/ToggleFeatureCard.cjs.js.map +0 -1
  473. package/dist/ToggleFeatureCard.js +0 -383
  474. package/dist/ToggleFeatureCard.js.map +0 -1
package/dist/EmailForm.js DELETED
@@ -1,4265 +0,0 @@
1
- import React, { useRef, useState, useContext } from 'react';
2
- import { useFormikContext, Field } from 'formik';
3
- import { isEditorEmpty, FormikEditor, EditorContent } from '@bigbinary/neeto-editor';
4
- import { Toastr, Button, Input as Input$1, Typography } from '@bigbinary/neetoui';
5
- import { Select, Input, MultiEmailInput, ActionBlock, Form } from '@bigbinary/neetoui/formik';
6
- import { useTranslation, Trans } from 'react-i18next';
7
- import { t } from 'i18next';
8
- import { prop } from 'ramda';
9
- import * as yup from 'yup';
10
- import { string } from 'yup';
11
- import { isNotEmpty, noop, isPresent } from '@bigbinary/neeto-commons-frontend/pure';
12
- import { Info, Upload } from '@bigbinary/neeto-icons';
13
- import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
14
- import require$$0 from 'stream';
15
- import { withEventTargetValue } from '@bigbinary/neeto-commons-frontend/utils';
16
- import DynamicVariables from '@bigbinary/neeto-molecules/DynamicVariables';
17
-
18
- function _typeof$1(obj) {
19
- "@babel/helpers - typeof";
20
-
21
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
22
- return typeof obj;
23
- } : function (obj) {
24
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
25
- }, _typeof$1(obj);
26
- }
27
-
28
- function _toPrimitive(input, hint) {
29
- if (_typeof$1(input) !== "object" || input === null) return input;
30
- var prim = input[Symbol.toPrimitive];
31
- if (prim !== undefined) {
32
- var res = prim.call(input, hint || "default");
33
- if (_typeof$1(res) !== "object") return res;
34
- throw new TypeError("@@toPrimitive must return a primitive value.");
35
- }
36
- return (hint === "string" ? String : Number)(input);
37
- }
38
-
39
- function _toPropertyKey(arg) {
40
- var key = _toPrimitive(arg, "string");
41
- return _typeof$1(key) === "symbol" ? key : String(key);
42
- }
43
-
44
- function _defineProperty(obj, key, value) {
45
- key = _toPropertyKey(key);
46
- if (key in obj) {
47
- Object.defineProperty(obj, key, {
48
- value: value,
49
- enumerable: true,
50
- configurable: true,
51
- writable: true
52
- });
53
- } else {
54
- obj[key] = value;
55
- }
56
- return obj;
57
- }
58
-
59
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
60
-
61
- var classnames$1 = {exports: {}};
62
-
63
- /*!
64
- Copyright (c) 2018 Jed Watson.
65
- Licensed under the MIT License (MIT), see
66
- http://jedwatson.github.io/classnames
67
- */
68
-
69
- (function (module) {
70
- /* global define */
71
-
72
- (function () {
73
-
74
- var hasOwn = {}.hasOwnProperty;
75
-
76
- function classNames() {
77
- var classes = [];
78
-
79
- for (var i = 0; i < arguments.length; i++) {
80
- var arg = arguments[i];
81
- if (!arg) continue;
82
-
83
- var argType = typeof arg;
84
-
85
- if (argType === 'string' || argType === 'number') {
86
- classes.push(arg);
87
- } else if (Array.isArray(arg)) {
88
- if (arg.length) {
89
- var inner = classNames.apply(null, arg);
90
- if (inner) {
91
- classes.push(inner);
92
- }
93
- }
94
- } else if (argType === 'object') {
95
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
96
- classes.push(arg.toString());
97
- continue;
98
- }
99
-
100
- for (var key in arg) {
101
- if (hasOwn.call(arg, key) && arg[key]) {
102
- classes.push(key);
103
- }
104
- }
105
- }
106
- }
107
-
108
- return classes.join(' ');
109
- }
110
-
111
- if (module.exports) {
112
- classNames.default = classNames;
113
- module.exports = classNames;
114
- } else {
115
- window.classNames = classNames;
116
- }
117
- }());
118
- } (classnames$1));
119
-
120
- var classnames = classnames$1.exports;
121
-
122
- var INITIAL_FORM_VALUES = {
123
- sendTo: [],
124
- sendToCc: [],
125
- sendToBcc: [],
126
- replyTo: "",
127
- showCopyEmails: false,
128
- subject: "",
129
- message: ""
130
- };
131
- var EMAIL_FORM_VALIDATION_SCHEMA = yup.object({
132
- subject: yup.string().required(t("neetoMolecules.emailForm.errors.subjectRequired")),
133
- message: yup.string().test("message", t("neetoMolecules.emailForm.errors.messageRequired"), function (value) {
134
- return !isEditorEmpty(value);
135
- })
136
- });
137
- var SEND_TO_FIELD_VALIDATION = yup.object({
138
- sendTo: yup.array().min(1, t("neetoMolecules.emailForm.errors.required", {
139
- entity: t("neetoMolecules.emailForm.fields.sendToEmailAddress")
140
- })).test("all-emails-valid", t("neetoMolecules.emailForm.errors.invalidEmailAddress"), function (emails) {
141
- return emails === null || emails === void 0 ? void 0 : emails.every(prop("valid"));
142
- }).nullable()
143
- });
144
- var REPLY_TO_FIELD_VALIDATION = yup.object({
145
- replyTo: yup.string().nullable().email(t("neetoMolecules.emailForm.errors.invalidEmailAddress")).required(t("neetoMolecules.emailForm.errors.required", {
146
- entity: t("neetoMolecules.emailForm.fields.replyToEmailAddress")
147
- }))
148
- });
149
- var EDITOR_ADDONS = ["highlight", "emoji", "code-block", "block-quote", "image-upload", "divider", "video-embed"];
150
-
151
- /* eslint-disable @bigbinary/neeto/use-zustand-for-global-state-management */
152
- var EmailFormContext = /*#__PURE__*/React.createContext({
153
- showSendToField: false,
154
- showReplyToField: false
155
- });
156
-
157
- var ReplyToField = function ReplyToField(_ref) {
158
- var _helpIconProps2;
159
- var replyToOptions = _ref.replyToOptions;
160
- var _useTranslation = useTranslation(),
161
- t = _useTranslation.t;
162
- var isDropdownField = isNotEmpty(replyToOptions);
163
- var _useFormikContext = useFormikContext(),
164
- setFieldValue = _useFormikContext.setFieldValue;
165
- if (isDropdownField) {
166
- var _helpIconProps;
167
- return /*#__PURE__*/React.createElement(Select, {
168
- className: "w-full",
169
- "data-testid": "replyToOptions",
170
- label: t("neetoMolecules.emailForm.labels.replyTo"),
171
- name: "replyTo",
172
- options: replyToOptions,
173
- labelProps: {
174
- helpIconProps: (_helpIconProps = {
175
- icon: Info
176
- }, _defineProperty(_helpIconProps, "data-testid", "reply-to-tooltip"), _defineProperty(_helpIconProps, "tooltipProps", {
177
- content: t("neetoMolecules.emailForm.tooltips.replyTo")
178
- }), _helpIconProps)
179
- },
180
- onChange: function onChange(_ref2) {
181
- var value = _ref2.value;
182
- return setFieldValue("replyTo", value);
183
- }
184
- });
185
- }
186
- return /*#__PURE__*/React.createElement(Input, {
187
- autoFocus: true,
188
- required: true,
189
- className: "w-full",
190
- "data-testid": "replyToInput",
191
- label: t("neetoMolecules.emailForm.labels.replyTo"),
192
- name: "replyTo",
193
- placeholder: t("neetoMolecules.emailForm.placeholders.emailPlaceholder"),
194
- size: "large",
195
- labelProps: {
196
- helpIconProps: (_helpIconProps2 = {
197
- icon: Info
198
- }, _defineProperty(_helpIconProps2, "data-testid", "reply-to-tooltip"), _defineProperty(_helpIconProps2, "tooltipProps", {
199
- content: t("neetoMolecules.emailForm.tooltips.replyTo")
200
- }), _helpIconProps2)
201
- }
202
- });
203
- };
204
-
205
- function _extends() {
206
- _extends = Object.assign ? Object.assign.bind() : function (target) {
207
- for (var i = 1; i < arguments.length; i++) {
208
- var source = arguments[i];
209
- for (var key in source) {
210
- if (Object.prototype.hasOwnProperty.call(source, key)) {
211
- target[key] = source[key];
212
- }
213
- }
214
- }
215
- return target;
216
- };
217
- return _extends.apply(this, arguments);
218
- }
219
-
220
- function _arrayLikeToArray(arr, len) {
221
- if (len == null || len > arr.length) len = arr.length;
222
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
223
- return arr2;
224
- }
225
-
226
- function _arrayWithoutHoles(arr) {
227
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
228
- }
229
-
230
- function _iterableToArray(iter) {
231
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
232
- }
233
-
234
- function _unsupportedIterableToArray(o, minLen) {
235
- if (!o) return;
236
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
237
- var n = Object.prototype.toString.call(o).slice(8, -1);
238
- if (n === "Object" && o.constructor) n = o.constructor.name;
239
- if (n === "Map" || n === "Set") return Array.from(o);
240
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
241
- }
242
-
243
- function _nonIterableSpread() {
244
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
245
- }
246
-
247
- function _toConsumableArray(arr) {
248
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
249
- }
250
-
251
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
252
- try {
253
- var info = gen[key](arg);
254
- var value = info.value;
255
- } catch (error) {
256
- reject(error);
257
- return;
258
- }
259
- if (info.done) {
260
- resolve(value);
261
- } else {
262
- Promise.resolve(value).then(_next, _throw);
263
- }
264
- }
265
- function _asyncToGenerator(fn) {
266
- return function () {
267
- var self = this,
268
- args = arguments;
269
- return new Promise(function (resolve, reject) {
270
- var gen = fn.apply(self, args);
271
- function _next(value) {
272
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
273
- }
274
- function _throw(err) {
275
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
276
- }
277
- _next(undefined);
278
- });
279
- };
280
- }
281
-
282
- var regeneratorRuntime$1 = {exports: {}};
283
-
284
- var _typeof = {exports: {}};
285
-
286
- (function (module) {
287
- function _typeof(obj) {
288
- "@babel/helpers - typeof";
289
-
290
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
291
- return typeof obj;
292
- } : function (obj) {
293
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
294
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
295
- }
296
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
297
- } (_typeof));
298
-
299
- (function (module) {
300
- var _typeof$1 = _typeof.exports["default"];
301
- function _regeneratorRuntime() {
302
- module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
303
- return exports;
304
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
305
- var exports = {},
306
- Op = Object.prototype,
307
- hasOwn = Op.hasOwnProperty,
308
- defineProperty = Object.defineProperty || function (obj, key, desc) {
309
- obj[key] = desc.value;
310
- },
311
- $Symbol = "function" == typeof Symbol ? Symbol : {},
312
- iteratorSymbol = $Symbol.iterator || "@@iterator",
313
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
314
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
315
- function define(obj, key, value) {
316
- return Object.defineProperty(obj, key, {
317
- value: value,
318
- enumerable: !0,
319
- configurable: !0,
320
- writable: !0
321
- }), obj[key];
322
- }
323
- try {
324
- define({}, "");
325
- } catch (err) {
326
- define = function define(obj, key, value) {
327
- return obj[key] = value;
328
- };
329
- }
330
- function wrap(innerFn, outerFn, self, tryLocsList) {
331
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
332
- generator = Object.create(protoGenerator.prototype),
333
- context = new Context(tryLocsList || []);
334
- return defineProperty(generator, "_invoke", {
335
- value: makeInvokeMethod(innerFn, self, context)
336
- }), generator;
337
- }
338
- function tryCatch(fn, obj, arg) {
339
- try {
340
- return {
341
- type: "normal",
342
- arg: fn.call(obj, arg)
343
- };
344
- } catch (err) {
345
- return {
346
- type: "throw",
347
- arg: err
348
- };
349
- }
350
- }
351
- exports.wrap = wrap;
352
- var ContinueSentinel = {};
353
- function Generator() {}
354
- function GeneratorFunction() {}
355
- function GeneratorFunctionPrototype() {}
356
- var IteratorPrototype = {};
357
- define(IteratorPrototype, iteratorSymbol, function () {
358
- return this;
359
- });
360
- var getProto = Object.getPrototypeOf,
361
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
362
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
363
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
364
- function defineIteratorMethods(prototype) {
365
- ["next", "throw", "return"].forEach(function (method) {
366
- define(prototype, method, function (arg) {
367
- return this._invoke(method, arg);
368
- });
369
- });
370
- }
371
- function AsyncIterator(generator, PromiseImpl) {
372
- function invoke(method, arg, resolve, reject) {
373
- var record = tryCatch(generator[method], generator, arg);
374
- if ("throw" !== record.type) {
375
- var result = record.arg,
376
- value = result.value;
377
- return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
378
- invoke("next", value, resolve, reject);
379
- }, function (err) {
380
- invoke("throw", err, resolve, reject);
381
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
382
- result.value = unwrapped, resolve(result);
383
- }, function (error) {
384
- return invoke("throw", error, resolve, reject);
385
- });
386
- }
387
- reject(record.arg);
388
- }
389
- var previousPromise;
390
- defineProperty(this, "_invoke", {
391
- value: function value(method, arg) {
392
- function callInvokeWithMethodAndArg() {
393
- return new PromiseImpl(function (resolve, reject) {
394
- invoke(method, arg, resolve, reject);
395
- });
396
- }
397
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
398
- }
399
- });
400
- }
401
- function makeInvokeMethod(innerFn, self, context) {
402
- var state = "suspendedStart";
403
- return function (method, arg) {
404
- if ("executing" === state) throw new Error("Generator is already running");
405
- if ("completed" === state) {
406
- if ("throw" === method) throw arg;
407
- return doneResult();
408
- }
409
- for (context.method = method, context.arg = arg;;) {
410
- var delegate = context.delegate;
411
- if (delegate) {
412
- var delegateResult = maybeInvokeDelegate(delegate, context);
413
- if (delegateResult) {
414
- if (delegateResult === ContinueSentinel) continue;
415
- return delegateResult;
416
- }
417
- }
418
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
419
- if ("suspendedStart" === state) throw state = "completed", context.arg;
420
- context.dispatchException(context.arg);
421
- } else "return" === context.method && context.abrupt("return", context.arg);
422
- state = "executing";
423
- var record = tryCatch(innerFn, self, context);
424
- if ("normal" === record.type) {
425
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
426
- return {
427
- value: record.arg,
428
- done: context.done
429
- };
430
- }
431
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
432
- }
433
- };
434
- }
435
- function maybeInvokeDelegate(delegate, context) {
436
- var methodName = context.method,
437
- method = delegate.iterator[methodName];
438
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
439
- var record = tryCatch(method, delegate.iterator, context.arg);
440
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
441
- var info = record.arg;
442
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
443
- }
444
- function pushTryEntry(locs) {
445
- var entry = {
446
- tryLoc: locs[0]
447
- };
448
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
449
- }
450
- function resetTryEntry(entry) {
451
- var record = entry.completion || {};
452
- record.type = "normal", delete record.arg, entry.completion = record;
453
- }
454
- function Context(tryLocsList) {
455
- this.tryEntries = [{
456
- tryLoc: "root"
457
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
458
- }
459
- function values(iterable) {
460
- if (iterable) {
461
- var iteratorMethod = iterable[iteratorSymbol];
462
- if (iteratorMethod) return iteratorMethod.call(iterable);
463
- if ("function" == typeof iterable.next) return iterable;
464
- if (!isNaN(iterable.length)) {
465
- var i = -1,
466
- next = function next() {
467
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
468
- return next.value = undefined, next.done = !0, next;
469
- };
470
- return next.next = next;
471
- }
472
- }
473
- return {
474
- next: doneResult
475
- };
476
- }
477
- function doneResult() {
478
- return {
479
- value: undefined,
480
- done: !0
481
- };
482
- }
483
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
484
- value: GeneratorFunctionPrototype,
485
- configurable: !0
486
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
487
- value: GeneratorFunction,
488
- configurable: !0
489
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
490
- var ctor = "function" == typeof genFun && genFun.constructor;
491
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
492
- }, exports.mark = function (genFun) {
493
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
494
- }, exports.awrap = function (arg) {
495
- return {
496
- __await: arg
497
- };
498
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
499
- return this;
500
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
501
- void 0 === PromiseImpl && (PromiseImpl = Promise);
502
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
503
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
504
- return result.done ? result.value : iter.next();
505
- });
506
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
507
- return this;
508
- }), define(Gp, "toString", function () {
509
- return "[object Generator]";
510
- }), exports.keys = function (val) {
511
- var object = Object(val),
512
- keys = [];
513
- for (var key in object) keys.push(key);
514
- return keys.reverse(), function next() {
515
- for (; keys.length;) {
516
- var key = keys.pop();
517
- if (key in object) return next.value = key, next.done = !1, next;
518
- }
519
- return next.done = !0, next;
520
- };
521
- }, exports.values = values, Context.prototype = {
522
- constructor: Context,
523
- reset: function reset(skipTempReset) {
524
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
525
- },
526
- stop: function stop() {
527
- this.done = !0;
528
- var rootRecord = this.tryEntries[0].completion;
529
- if ("throw" === rootRecord.type) throw rootRecord.arg;
530
- return this.rval;
531
- },
532
- dispatchException: function dispatchException(exception) {
533
- if (this.done) throw exception;
534
- var context = this;
535
- function handle(loc, caught) {
536
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
537
- }
538
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
539
- var entry = this.tryEntries[i],
540
- record = entry.completion;
541
- if ("root" === entry.tryLoc) return handle("end");
542
- if (entry.tryLoc <= this.prev) {
543
- var hasCatch = hasOwn.call(entry, "catchLoc"),
544
- hasFinally = hasOwn.call(entry, "finallyLoc");
545
- if (hasCatch && hasFinally) {
546
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
547
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
548
- } else if (hasCatch) {
549
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
550
- } else {
551
- if (!hasFinally) throw new Error("try statement without catch or finally");
552
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
553
- }
554
- }
555
- }
556
- },
557
- abrupt: function abrupt(type, arg) {
558
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
559
- var entry = this.tryEntries[i];
560
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
561
- var finallyEntry = entry;
562
- break;
563
- }
564
- }
565
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
566
- var record = finallyEntry ? finallyEntry.completion : {};
567
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
568
- },
569
- complete: function complete(record, afterLoc) {
570
- if ("throw" === record.type) throw record.arg;
571
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
572
- },
573
- finish: function finish(finallyLoc) {
574
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
575
- var entry = this.tryEntries[i];
576
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
577
- }
578
- },
579
- "catch": function _catch(tryLoc) {
580
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
581
- var entry = this.tryEntries[i];
582
- if (entry.tryLoc === tryLoc) {
583
- var record = entry.completion;
584
- if ("throw" === record.type) {
585
- var thrown = record.arg;
586
- resetTryEntry(entry);
587
- }
588
- return thrown;
589
- }
590
- }
591
- throw new Error("illegal catch attempt");
592
- },
593
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
594
- return this.delegate = {
595
- iterator: values(iterable),
596
- resultName: resultName,
597
- nextLoc: nextLoc
598
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
599
- }
600
- }, exports;
601
- }
602
- module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
603
- } (regeneratorRuntime$1));
604
-
605
- // TODO(Babel 8): Remove this file.
606
-
607
- var runtime = regeneratorRuntime$1.exports();
608
- var regenerator = runtime;
609
-
610
- // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
611
- try {
612
- regeneratorRuntime = runtime;
613
- } catch (accidentalStrictMode) {
614
- if (typeof globalThis === "object") {
615
- globalThis.regeneratorRuntime = runtime;
616
- } else {
617
- Function("r", "regeneratorRuntime = r")(runtime);
618
- }
619
- }
620
-
621
- var ALLOWED_FILE_PICKER_TYPES = [".csv"];
622
-
623
- var FilePicker = function FilePicker(_ref) {
624
- var _ref$types = _ref.types,
625
- types = _ref$types === void 0 ? [] : _ref$types,
626
- onChange = _ref.onChange,
627
- children = _ref.children;
628
- var inputRef = useRef();
629
- var accept = types.reduce(function (acc, ext) {
630
- return "".concat(acc, ", ").concat(ext);
631
- }, "");
632
- var handleInputChange = function handleInputChange(_ref2) {
633
- var target = _ref2.target;
634
- if (!target.files) return;
635
- onChange(target.files);
636
-
637
- // This will trigger handleClick when same file is uploaded again.
638
- inputRef.current.value = "";
639
- handleClick();
640
- };
641
- var handleClick = function handleClick() {
642
- if (!inputRef.current) return;
643
- inputRef.current.click();
644
- };
645
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
646
- onClick: handleClick
647
- }, children), /*#__PURE__*/React.createElement("input", {
648
- accept: accept,
649
- className: "hidden",
650
- ref: inputRef,
651
- type: "file",
652
- onChange: handleInputChange
653
- }));
654
- };
655
-
656
- var papaparse = {exports: {}};
657
-
658
- /* @license
659
- Papa Parse
660
- v5.4.0
661
- https://github.com/mholt/PapaParse
662
- License: MIT
663
- */
664
-
665
- (function (module, exports) {
666
- (function(root, factory)
667
- {
668
- /* globals define */
669
- {
670
- // Node. Does not work with strict CommonJS, but
671
- // only CommonJS-like environments that support module.exports,
672
- // like Node.
673
- module.exports = factory();
674
- }
675
- // in strict mode we cannot access arguments.callee, so we need a named reference to
676
- // stringify the factory method for the blob worker
677
- // eslint-disable-next-line func-name
678
- }(commonjsGlobal, function moduleFactory()
679
- {
680
-
681
- var global = (function() {
682
- // alternative method, similar to `Function('return this')()`
683
- // but without using `eval` (which is disabled when
684
- // using Content Security Policy).
685
-
686
- if (typeof self !== 'undefined') { return self; }
687
- if (typeof window !== 'undefined') { return window; }
688
- if (typeof global !== 'undefined') { return global; }
689
-
690
- // When running tests none of the above have been defined
691
- return {};
692
- })();
693
-
694
-
695
- function getWorkerBlob() {
696
- var URL = global.URL || global.webkitURL || null;
697
- var code = moduleFactory.toString();
698
- return Papa.BLOB_URL || (Papa.BLOB_URL = URL.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", '(', code, ')();'], {type: 'text/javascript'})));
699
- }
700
-
701
- var IS_WORKER = !global.document && !!global.postMessage,
702
- IS_PAPA_WORKER = global.IS_PAPA_WORKER || false;
703
-
704
- var workers = {}, workerIdCounter = 0;
705
-
706
- var Papa = {};
707
-
708
- Papa.parse = CsvToJson;
709
- Papa.unparse = JsonToCsv;
710
-
711
- Papa.RECORD_SEP = String.fromCharCode(30);
712
- Papa.UNIT_SEP = String.fromCharCode(31);
713
- Papa.BYTE_ORDER_MARK = '\ufeff';
714
- Papa.BAD_DELIMITERS = ['\r', '\n', '"', Papa.BYTE_ORDER_MARK];
715
- Papa.WORKERS_SUPPORTED = !IS_WORKER && !!global.Worker;
716
- Papa.NODE_STREAM_INPUT = 1;
717
-
718
- // Configurable chunk sizes for local and remote files, respectively
719
- Papa.LocalChunkSize = 1024 * 1024 * 10; // 10 MB
720
- Papa.RemoteChunkSize = 1024 * 1024 * 5; // 5 MB
721
- Papa.DefaultDelimiter = ','; // Used if not specified and detection fails
722
-
723
- // Exposed for testing and development only
724
- Papa.Parser = Parser;
725
- Papa.ParserHandle = ParserHandle;
726
- Papa.NetworkStreamer = NetworkStreamer;
727
- Papa.FileStreamer = FileStreamer;
728
- Papa.StringStreamer = StringStreamer;
729
- Papa.ReadableStreamStreamer = ReadableStreamStreamer;
730
- if (typeof PAPA_BROWSER_CONTEXT === 'undefined') {
731
- Papa.DuplexStreamStreamer = DuplexStreamStreamer;
732
- }
733
-
734
- if (global.jQuery)
735
- {
736
- var $ = global.jQuery;
737
- $.fn.parse = function(options)
738
- {
739
- var config = options.config || {};
740
- var queue = [];
741
-
742
- this.each(function(idx)
743
- {
744
- var supported = $(this).prop('tagName').toUpperCase() === 'INPUT'
745
- && $(this).attr('type').toLowerCase() === 'file'
746
- && global.FileReader;
747
-
748
- if (!supported || !this.files || this.files.length === 0)
749
- return true; // continue to next input element
750
-
751
- for (var i = 0; i < this.files.length; i++)
752
- {
753
- queue.push({
754
- file: this.files[i],
755
- inputElem: this,
756
- instanceConfig: $.extend({}, config)
757
- });
758
- }
759
- });
760
-
761
- parseNextFile(); // begin parsing
762
- return this; // maintains chainability
763
-
764
-
765
- function parseNextFile()
766
- {
767
- if (queue.length === 0)
768
- {
769
- if (isFunction(options.complete))
770
- options.complete();
771
- return;
772
- }
773
-
774
- var f = queue[0];
775
-
776
- if (isFunction(options.before))
777
- {
778
- var returned = options.before(f.file, f.inputElem);
779
-
780
- if (typeof returned === 'object')
781
- {
782
- if (returned.action === 'abort')
783
- {
784
- error('AbortError', f.file, f.inputElem, returned.reason);
785
- return; // Aborts all queued files immediately
786
- }
787
- else if (returned.action === 'skip')
788
- {
789
- fileComplete(); // parse the next file in the queue, if any
790
- return;
791
- }
792
- else if (typeof returned.config === 'object')
793
- f.instanceConfig = $.extend(f.instanceConfig, returned.config);
794
- }
795
- else if (returned === 'skip')
796
- {
797
- fileComplete(); // parse the next file in the queue, if any
798
- return;
799
- }
800
- }
801
-
802
- // Wrap up the user's complete callback, if any, so that ours also gets executed
803
- var userCompleteFunc = f.instanceConfig.complete;
804
- f.instanceConfig.complete = function(results)
805
- {
806
- if (isFunction(userCompleteFunc))
807
- userCompleteFunc(results, f.file, f.inputElem);
808
- fileComplete();
809
- };
810
-
811
- Papa.parse(f.file, f.instanceConfig);
812
- }
813
-
814
- function error(name, file, elem, reason)
815
- {
816
- if (isFunction(options.error))
817
- options.error({name: name}, file, elem, reason);
818
- }
819
-
820
- function fileComplete()
821
- {
822
- queue.splice(0, 1);
823
- parseNextFile();
824
- }
825
- };
826
- }
827
-
828
-
829
- if (IS_PAPA_WORKER)
830
- {
831
- global.onmessage = workerThreadReceivedMessage;
832
- }
833
-
834
-
835
-
836
-
837
- function CsvToJson(_input, _config)
838
- {
839
- _config = _config || {};
840
- var dynamicTyping = _config.dynamicTyping || false;
841
- if (isFunction(dynamicTyping)) {
842
- _config.dynamicTypingFunction = dynamicTyping;
843
- // Will be filled on first row call
844
- dynamicTyping = {};
845
- }
846
- _config.dynamicTyping = dynamicTyping;
847
-
848
- _config.transform = isFunction(_config.transform) ? _config.transform : false;
849
-
850
- if (_config.worker && Papa.WORKERS_SUPPORTED)
851
- {
852
- var w = newWorker();
853
-
854
- w.userStep = _config.step;
855
- w.userChunk = _config.chunk;
856
- w.userComplete = _config.complete;
857
- w.userError = _config.error;
858
-
859
- _config.step = isFunction(_config.step);
860
- _config.chunk = isFunction(_config.chunk);
861
- _config.complete = isFunction(_config.complete);
862
- _config.error = isFunction(_config.error);
863
- delete _config.worker; // prevent infinite loop
864
-
865
- w.postMessage({
866
- input: _input,
867
- config: _config,
868
- workerId: w.id
869
- });
870
-
871
- return;
872
- }
873
-
874
- var streamer = null;
875
- if (_input === Papa.NODE_STREAM_INPUT && typeof PAPA_BROWSER_CONTEXT === 'undefined')
876
- {
877
- // create a node Duplex stream for use
878
- // with .pipe
879
- streamer = new DuplexStreamStreamer(_config);
880
- return streamer.getStream();
881
- }
882
- else if (typeof _input === 'string')
883
- {
884
- _input = stripBom(_input);
885
- if (_config.download)
886
- streamer = new NetworkStreamer(_config);
887
- else
888
- streamer = new StringStreamer(_config);
889
- }
890
- else if (_input.readable === true && isFunction(_input.read) && isFunction(_input.on))
891
- {
892
- streamer = new ReadableStreamStreamer(_config);
893
- }
894
- else if ((global.File && _input instanceof File) || _input instanceof Object) // ...Safari. (see issue #106)
895
- streamer = new FileStreamer(_config);
896
-
897
- return streamer.stream(_input);
898
-
899
- // Strip character from UTF-8 BOM encoded files that cause issue parsing the file
900
- function stripBom(string) {
901
- if (string.charCodeAt(0) === 0xfeff) {
902
- return string.slice(1);
903
- }
904
- return string;
905
- }
906
- }
907
-
908
-
909
-
910
-
911
-
912
-
913
- function JsonToCsv(_input, _config)
914
- {
915
- // Default configuration
916
-
917
- /** whether to surround every datum with quotes */
918
- var _quotes = false;
919
-
920
- /** whether to write headers */
921
- var _writeHeader = true;
922
-
923
- /** delimiting character(s) */
924
- var _delimiter = ',';
925
-
926
- /** newline character(s) */
927
- var _newline = '\r\n';
928
-
929
- /** quote character */
930
- var _quoteChar = '"';
931
-
932
- /** escaped quote character, either "" or <config.escapeChar>" */
933
- var _escapedQuote = _quoteChar + _quoteChar;
934
-
935
- /** whether to skip empty lines */
936
- var _skipEmptyLines = false;
937
-
938
- /** the columns (keys) we expect when we unparse objects */
939
- var _columns = null;
940
-
941
- /** whether to prevent outputting cells that can be parsed as formulae by spreadsheet software (Excel and LibreOffice) */
942
- var _escapeFormulae = false;
943
-
944
- unpackConfig();
945
-
946
- var quoteCharRegex = new RegExp(escapeRegExp(_quoteChar), 'g');
947
-
948
- if (typeof _input === 'string')
949
- _input = JSON.parse(_input);
950
-
951
- if (Array.isArray(_input))
952
- {
953
- if (!_input.length || Array.isArray(_input[0]))
954
- return serialize(null, _input, _skipEmptyLines);
955
- else if (typeof _input[0] === 'object')
956
- return serialize(_columns || Object.keys(_input[0]), _input, _skipEmptyLines);
957
- }
958
- else if (typeof _input === 'object')
959
- {
960
- if (typeof _input.data === 'string')
961
- _input.data = JSON.parse(_input.data);
962
-
963
- if (Array.isArray(_input.data))
964
- {
965
- if (!_input.fields)
966
- _input.fields = _input.meta && _input.meta.fields || _columns;
967
-
968
- if (!_input.fields)
969
- _input.fields = Array.isArray(_input.data[0])
970
- ? _input.fields
971
- : typeof _input.data[0] === 'object'
972
- ? Object.keys(_input.data[0])
973
- : [];
974
-
975
- if (!(Array.isArray(_input.data[0])) && typeof _input.data[0] !== 'object')
976
- _input.data = [_input.data]; // handles input like [1,2,3] or ['asdf']
977
- }
978
-
979
- return serialize(_input.fields || [], _input.data || [], _skipEmptyLines);
980
- }
981
-
982
- // Default (any valid paths should return before this)
983
- throw new Error('Unable to serialize unrecognized input');
984
-
985
-
986
- function unpackConfig()
987
- {
988
- if (typeof _config !== 'object')
989
- return;
990
-
991
- if (typeof _config.delimiter === 'string'
992
- && !Papa.BAD_DELIMITERS.filter(function(value) { return _config.delimiter.indexOf(value) !== -1; }).length)
993
- {
994
- _delimiter = _config.delimiter;
995
- }
996
-
997
- if (typeof _config.quotes === 'boolean'
998
- || typeof _config.quotes === 'function'
999
- || Array.isArray(_config.quotes))
1000
- _quotes = _config.quotes;
1001
-
1002
- if (typeof _config.skipEmptyLines === 'boolean'
1003
- || typeof _config.skipEmptyLines === 'string')
1004
- _skipEmptyLines = _config.skipEmptyLines;
1005
-
1006
- if (typeof _config.newline === 'string')
1007
- _newline = _config.newline;
1008
-
1009
- if (typeof _config.quoteChar === 'string')
1010
- _quoteChar = _config.quoteChar;
1011
-
1012
- if (typeof _config.header === 'boolean')
1013
- _writeHeader = _config.header;
1014
-
1015
- if (Array.isArray(_config.columns)) {
1016
-
1017
- if (_config.columns.length === 0) throw new Error('Option columns is empty');
1018
-
1019
- _columns = _config.columns;
1020
- }
1021
-
1022
- if (_config.escapeChar !== undefined) {
1023
- _escapedQuote = _config.escapeChar + _quoteChar;
1024
- }
1025
-
1026
- if (typeof _config.escapeFormulae === 'boolean' || _config.escapeFormulae instanceof RegExp) {
1027
- _escapeFormulae = _config.escapeFormulae instanceof RegExp ? _config.escapeFormulae : /^[=+\-@\t\r].*$/;
1028
- }
1029
- }
1030
-
1031
- /** The double for loop that iterates the data and writes out a CSV string including header row */
1032
- function serialize(fields, data, skipEmptyLines)
1033
- {
1034
- var csv = '';
1035
-
1036
- if (typeof fields === 'string')
1037
- fields = JSON.parse(fields);
1038
- if (typeof data === 'string')
1039
- data = JSON.parse(data);
1040
-
1041
- var hasHeader = Array.isArray(fields) && fields.length > 0;
1042
- var dataKeyedByField = !(Array.isArray(data[0]));
1043
-
1044
- // If there a header row, write it first
1045
- if (hasHeader && _writeHeader)
1046
- {
1047
- for (var i = 0; i < fields.length; i++)
1048
- {
1049
- if (i > 0)
1050
- csv += _delimiter;
1051
- csv += safe(fields[i], i);
1052
- }
1053
- if (data.length > 0)
1054
- csv += _newline;
1055
- }
1056
-
1057
- // Then write out the data
1058
- for (var row = 0; row < data.length; row++)
1059
- {
1060
- var maxCol = hasHeader ? fields.length : data[row].length;
1061
-
1062
- var emptyLine = false;
1063
- var nullLine = hasHeader ? Object.keys(data[row]).length === 0 : data[row].length === 0;
1064
- if (skipEmptyLines && !hasHeader)
1065
- {
1066
- emptyLine = skipEmptyLines === 'greedy' ? data[row].join('').trim() === '' : data[row].length === 1 && data[row][0].length === 0;
1067
- }
1068
- if (skipEmptyLines === 'greedy' && hasHeader) {
1069
- var line = [];
1070
- for (var c = 0; c < maxCol; c++) {
1071
- var cx = dataKeyedByField ? fields[c] : c;
1072
- line.push(data[row][cx]);
1073
- }
1074
- emptyLine = line.join('').trim() === '';
1075
- }
1076
- if (!emptyLine)
1077
- {
1078
- for (var col = 0; col < maxCol; col++)
1079
- {
1080
- if (col > 0 && !nullLine)
1081
- csv += _delimiter;
1082
- var colIdx = hasHeader && dataKeyedByField ? fields[col] : col;
1083
- csv += safe(data[row][colIdx], col);
1084
- }
1085
- if (row < data.length - 1 && (!skipEmptyLines || (maxCol > 0 && !nullLine)))
1086
- {
1087
- csv += _newline;
1088
- }
1089
- }
1090
- }
1091
- return csv;
1092
- }
1093
-
1094
- /** Encloses a value around quotes if needed (makes a value safe for CSV insertion) */
1095
- function safe(str, col)
1096
- {
1097
- if (typeof str === 'undefined' || str === null)
1098
- return '';
1099
-
1100
- if (str.constructor === Date)
1101
- return JSON.stringify(str).slice(1, 25);
1102
-
1103
- var needsQuotes = false;
1104
-
1105
- if (_escapeFormulae && typeof str === "string" && _escapeFormulae.test(str)) {
1106
- str = "'" + str;
1107
- needsQuotes = true;
1108
- }
1109
-
1110
- var escapedQuoteStr = str.toString().replace(quoteCharRegex, _escapedQuote);
1111
-
1112
- needsQuotes = needsQuotes
1113
- || _quotes === true
1114
- || (typeof _quotes === 'function' && _quotes(str, col))
1115
- || (Array.isArray(_quotes) && _quotes[col])
1116
- || hasAny(escapedQuoteStr, Papa.BAD_DELIMITERS)
1117
- || escapedQuoteStr.indexOf(_delimiter) > -1
1118
- || escapedQuoteStr.charAt(0) === ' '
1119
- || escapedQuoteStr.charAt(escapedQuoteStr.length - 1) === ' ';
1120
-
1121
- return needsQuotes ? _quoteChar + escapedQuoteStr + _quoteChar : escapedQuoteStr;
1122
- }
1123
-
1124
- function hasAny(str, substrings)
1125
- {
1126
- for (var i = 0; i < substrings.length; i++)
1127
- if (str.indexOf(substrings[i]) > -1)
1128
- return true;
1129
- return false;
1130
- }
1131
- }
1132
-
1133
- /** ChunkStreamer is the base prototype for various streamer implementations. */
1134
- function ChunkStreamer(config)
1135
- {
1136
- this._handle = null;
1137
- this._finished = false;
1138
- this._completed = false;
1139
- this._halted = false;
1140
- this._input = null;
1141
- this._baseIndex = 0;
1142
- this._partialLine = '';
1143
- this._rowCount = 0;
1144
- this._start = 0;
1145
- this._nextChunk = null;
1146
- this.isFirstChunk = true;
1147
- this._completeResults = {
1148
- data: [],
1149
- errors: [],
1150
- meta: {}
1151
- };
1152
- replaceConfig.call(this, config);
1153
-
1154
- this.parseChunk = function(chunk, isFakeChunk)
1155
- {
1156
- // First chunk pre-processing
1157
- if (this.isFirstChunk && isFunction(this._config.beforeFirstChunk))
1158
- {
1159
- var modifiedChunk = this._config.beforeFirstChunk(chunk);
1160
- if (modifiedChunk !== undefined)
1161
- chunk = modifiedChunk;
1162
- }
1163
- this.isFirstChunk = false;
1164
- this._halted = false;
1165
-
1166
- // Rejoin the line we likely just split in two by chunking the file
1167
- var aggregate = this._partialLine + chunk;
1168
- this._partialLine = '';
1169
-
1170
- var results = this._handle.parse(aggregate, this._baseIndex, !this._finished);
1171
-
1172
- if (this._handle.paused() || this._handle.aborted()) {
1173
- this._halted = true;
1174
- return;
1175
- }
1176
-
1177
- var lastIndex = results.meta.cursor;
1178
-
1179
- if (!this._finished)
1180
- {
1181
- this._partialLine = aggregate.substring(lastIndex - this._baseIndex);
1182
- this._baseIndex = lastIndex;
1183
- }
1184
-
1185
- if (results && results.data)
1186
- this._rowCount += results.data.length;
1187
-
1188
- var finishedIncludingPreview = this._finished || (this._config.preview && this._rowCount >= this._config.preview);
1189
-
1190
- if (IS_PAPA_WORKER)
1191
- {
1192
- global.postMessage({
1193
- results: results,
1194
- workerId: Papa.WORKER_ID,
1195
- finished: finishedIncludingPreview
1196
- });
1197
- }
1198
- else if (isFunction(this._config.chunk) && !isFakeChunk)
1199
- {
1200
- this._config.chunk(results, this._handle);
1201
- if (this._handle.paused() || this._handle.aborted()) {
1202
- this._halted = true;
1203
- return;
1204
- }
1205
- results = undefined;
1206
- this._completeResults = undefined;
1207
- }
1208
-
1209
- if (!this._config.step && !this._config.chunk) {
1210
- this._completeResults.data = this._completeResults.data.concat(results.data);
1211
- this._completeResults.errors = this._completeResults.errors.concat(results.errors);
1212
- this._completeResults.meta = results.meta;
1213
- }
1214
-
1215
- if (!this._completed && finishedIncludingPreview && isFunction(this._config.complete) && (!results || !results.meta.aborted)) {
1216
- this._config.complete(this._completeResults, this._input);
1217
- this._completed = true;
1218
- }
1219
-
1220
- if (!finishedIncludingPreview && (!results || !results.meta.paused))
1221
- this._nextChunk();
1222
-
1223
- return results;
1224
- };
1225
-
1226
- this._sendError = function(error)
1227
- {
1228
- if (isFunction(this._config.error))
1229
- this._config.error(error);
1230
- else if (IS_PAPA_WORKER && this._config.error)
1231
- {
1232
- global.postMessage({
1233
- workerId: Papa.WORKER_ID,
1234
- error: error,
1235
- finished: false
1236
- });
1237
- }
1238
- };
1239
-
1240
- function replaceConfig(config)
1241
- {
1242
- // Deep-copy the config so we can edit it
1243
- var configCopy = copy(config);
1244
- configCopy.chunkSize = parseInt(configCopy.chunkSize); // parseInt VERY important so we don't concatenate strings!
1245
- if (!config.step && !config.chunk)
1246
- configCopy.chunkSize = null; // disable Range header if not streaming; bad values break IIS - see issue #196
1247
- this._handle = new ParserHandle(configCopy);
1248
- this._handle.streamer = this;
1249
- this._config = configCopy; // persist the copy to the caller
1250
- }
1251
- }
1252
-
1253
-
1254
- function NetworkStreamer(config)
1255
- {
1256
- config = config || {};
1257
- if (!config.chunkSize)
1258
- config.chunkSize = Papa.RemoteChunkSize;
1259
- ChunkStreamer.call(this, config);
1260
-
1261
- var xhr;
1262
-
1263
- if (IS_WORKER)
1264
- {
1265
- this._nextChunk = function()
1266
- {
1267
- this._readChunk();
1268
- this._chunkLoaded();
1269
- };
1270
- }
1271
- else
1272
- {
1273
- this._nextChunk = function()
1274
- {
1275
- this._readChunk();
1276
- };
1277
- }
1278
-
1279
- this.stream = function(url)
1280
- {
1281
- this._input = url;
1282
- this._nextChunk(); // Starts streaming
1283
- };
1284
-
1285
- this._readChunk = function()
1286
- {
1287
- if (this._finished)
1288
- {
1289
- this._chunkLoaded();
1290
- return;
1291
- }
1292
-
1293
- xhr = new XMLHttpRequest();
1294
-
1295
- if (this._config.withCredentials)
1296
- {
1297
- xhr.withCredentials = this._config.withCredentials;
1298
- }
1299
-
1300
- if (!IS_WORKER)
1301
- {
1302
- xhr.onload = bindFunction(this._chunkLoaded, this);
1303
- xhr.onerror = bindFunction(this._chunkError, this);
1304
- }
1305
-
1306
- xhr.open(this._config.downloadRequestBody ? 'POST' : 'GET', this._input, !IS_WORKER);
1307
- // Headers can only be set when once the request state is OPENED
1308
- if (this._config.downloadRequestHeaders)
1309
- {
1310
- var headers = this._config.downloadRequestHeaders;
1311
-
1312
- for (var headerName in headers)
1313
- {
1314
- xhr.setRequestHeader(headerName, headers[headerName]);
1315
- }
1316
- }
1317
-
1318
- if (this._config.chunkSize)
1319
- {
1320
- var end = this._start + this._config.chunkSize - 1; // minus one because byte range is inclusive
1321
- xhr.setRequestHeader('Range', 'bytes=' + this._start + '-' + end);
1322
- }
1323
-
1324
- try {
1325
- xhr.send(this._config.downloadRequestBody);
1326
- }
1327
- catch (err) {
1328
- this._chunkError(err.message);
1329
- }
1330
-
1331
- if (IS_WORKER && xhr.status === 0)
1332
- this._chunkError();
1333
- };
1334
-
1335
- this._chunkLoaded = function()
1336
- {
1337
- if (xhr.readyState !== 4)
1338
- return;
1339
-
1340
- if (xhr.status < 200 || xhr.status >= 400)
1341
- {
1342
- this._chunkError();
1343
- return;
1344
- }
1345
-
1346
- // Use chunckSize as it may be a diference on reponse lentgh due to characters with more than 1 byte
1347
- this._start += this._config.chunkSize ? this._config.chunkSize : xhr.responseText.length;
1348
- this._finished = !this._config.chunkSize || this._start >= getFileSize(xhr);
1349
- this.parseChunk(xhr.responseText);
1350
- };
1351
-
1352
- this._chunkError = function(errorMessage)
1353
- {
1354
- var errorText = xhr.statusText || errorMessage;
1355
- this._sendError(new Error(errorText));
1356
- };
1357
-
1358
- function getFileSize(xhr)
1359
- {
1360
- var contentRange = xhr.getResponseHeader('Content-Range');
1361
- if (contentRange === null) { // no content range, then finish!
1362
- return -1;
1363
- }
1364
- return parseInt(contentRange.substring(contentRange.lastIndexOf('/') + 1));
1365
- }
1366
- }
1367
- NetworkStreamer.prototype = Object.create(ChunkStreamer.prototype);
1368
- NetworkStreamer.prototype.constructor = NetworkStreamer;
1369
-
1370
-
1371
- function FileStreamer(config)
1372
- {
1373
- config = config || {};
1374
- if (!config.chunkSize)
1375
- config.chunkSize = Papa.LocalChunkSize;
1376
- ChunkStreamer.call(this, config);
1377
-
1378
- var reader, slice;
1379
-
1380
- // FileReader is better than FileReaderSync (even in worker) - see http://stackoverflow.com/q/24708649/1048862
1381
- // But Firefox is a pill, too - see issue #76: https://github.com/mholt/PapaParse/issues/76
1382
- var usingAsyncReader = typeof FileReader !== 'undefined'; // Safari doesn't consider it a function - see issue #105
1383
-
1384
- this.stream = function(file)
1385
- {
1386
- this._input = file;
1387
- slice = file.slice || file.webkitSlice || file.mozSlice;
1388
-
1389
- if (usingAsyncReader)
1390
- {
1391
- reader = new FileReader(); // Preferred method of reading files, even in workers
1392
- reader.onload = bindFunction(this._chunkLoaded, this);
1393
- reader.onerror = bindFunction(this._chunkError, this);
1394
- }
1395
- else
1396
- reader = new FileReaderSync(); // Hack for running in a web worker in Firefox
1397
-
1398
- this._nextChunk(); // Starts streaming
1399
- };
1400
-
1401
- this._nextChunk = function()
1402
- {
1403
- if (!this._finished && (!this._config.preview || this._rowCount < this._config.preview))
1404
- this._readChunk();
1405
- };
1406
-
1407
- this._readChunk = function()
1408
- {
1409
- var input = this._input;
1410
- if (this._config.chunkSize)
1411
- {
1412
- var end = Math.min(this._start + this._config.chunkSize, this._input.size);
1413
- input = slice.call(input, this._start, end);
1414
- }
1415
- var txt = reader.readAsText(input, this._config.encoding);
1416
- if (!usingAsyncReader)
1417
- this._chunkLoaded({ target: { result: txt } }); // mimic the async signature
1418
- };
1419
-
1420
- this._chunkLoaded = function(event)
1421
- {
1422
- // Very important to increment start each time before handling results
1423
- this._start += this._config.chunkSize;
1424
- this._finished = !this._config.chunkSize || this._start >= this._input.size;
1425
- this.parseChunk(event.target.result);
1426
- };
1427
-
1428
- this._chunkError = function()
1429
- {
1430
- this._sendError(reader.error);
1431
- };
1432
-
1433
- }
1434
- FileStreamer.prototype = Object.create(ChunkStreamer.prototype);
1435
- FileStreamer.prototype.constructor = FileStreamer;
1436
-
1437
-
1438
- function StringStreamer(config)
1439
- {
1440
- config = config || {};
1441
- ChunkStreamer.call(this, config);
1442
-
1443
- var remaining;
1444
- this.stream = function(s)
1445
- {
1446
- remaining = s;
1447
- return this._nextChunk();
1448
- };
1449
- this._nextChunk = function()
1450
- {
1451
- if (this._finished) return;
1452
- var size = this._config.chunkSize;
1453
- var chunk;
1454
- if(size) {
1455
- chunk = remaining.substring(0, size);
1456
- remaining = remaining.substring(size);
1457
- } else {
1458
- chunk = remaining;
1459
- remaining = '';
1460
- }
1461
- this._finished = !remaining;
1462
- return this.parseChunk(chunk);
1463
- };
1464
- }
1465
- StringStreamer.prototype = Object.create(StringStreamer.prototype);
1466
- StringStreamer.prototype.constructor = StringStreamer;
1467
-
1468
-
1469
- function ReadableStreamStreamer(config)
1470
- {
1471
- config = config || {};
1472
-
1473
- ChunkStreamer.call(this, config);
1474
-
1475
- var queue = [];
1476
- var parseOnData = true;
1477
- var streamHasEnded = false;
1478
-
1479
- this.pause = function()
1480
- {
1481
- ChunkStreamer.prototype.pause.apply(this, arguments);
1482
- this._input.pause();
1483
- };
1484
-
1485
- this.resume = function()
1486
- {
1487
- ChunkStreamer.prototype.resume.apply(this, arguments);
1488
- this._input.resume();
1489
- };
1490
-
1491
- this.stream = function(stream)
1492
- {
1493
- this._input = stream;
1494
-
1495
- this._input.on('data', this._streamData);
1496
- this._input.on('end', this._streamEnd);
1497
- this._input.on('error', this._streamError);
1498
- };
1499
-
1500
- this._checkIsFinished = function()
1501
- {
1502
- if (streamHasEnded && queue.length === 1) {
1503
- this._finished = true;
1504
- }
1505
- };
1506
-
1507
- this._nextChunk = function()
1508
- {
1509
- this._checkIsFinished();
1510
- if (queue.length)
1511
- {
1512
- this.parseChunk(queue.shift());
1513
- }
1514
- else
1515
- {
1516
- parseOnData = true;
1517
- }
1518
- };
1519
-
1520
- this._streamData = bindFunction(function(chunk)
1521
- {
1522
- try
1523
- {
1524
- queue.push(typeof chunk === 'string' ? chunk : chunk.toString(this._config.encoding));
1525
-
1526
- if (parseOnData)
1527
- {
1528
- parseOnData = false;
1529
- this._checkIsFinished();
1530
- this.parseChunk(queue.shift());
1531
- }
1532
- }
1533
- catch (error)
1534
- {
1535
- this._streamError(error);
1536
- }
1537
- }, this);
1538
-
1539
- this._streamError = bindFunction(function(error)
1540
- {
1541
- this._streamCleanUp();
1542
- this._sendError(error);
1543
- }, this);
1544
-
1545
- this._streamEnd = bindFunction(function()
1546
- {
1547
- this._streamCleanUp();
1548
- streamHasEnded = true;
1549
- this._streamData('');
1550
- }, this);
1551
-
1552
- this._streamCleanUp = bindFunction(function()
1553
- {
1554
- this._input.removeListener('data', this._streamData);
1555
- this._input.removeListener('end', this._streamEnd);
1556
- this._input.removeListener('error', this._streamError);
1557
- }, this);
1558
- }
1559
- ReadableStreamStreamer.prototype = Object.create(ChunkStreamer.prototype);
1560
- ReadableStreamStreamer.prototype.constructor = ReadableStreamStreamer;
1561
-
1562
-
1563
- function DuplexStreamStreamer(_config) {
1564
- var Duplex = require$$0.Duplex;
1565
- var config = copy(_config);
1566
- var parseOnWrite = true;
1567
- var writeStreamHasFinished = false;
1568
- var parseCallbackQueue = [];
1569
- var stream = null;
1570
-
1571
- this._onCsvData = function(results)
1572
- {
1573
- var data = results.data;
1574
- if (!stream.push(data) && !this._handle.paused()) {
1575
- // the writeable consumer buffer has filled up
1576
- // so we need to pause until more items
1577
- // can be processed
1578
- this._handle.pause();
1579
- }
1580
- };
1581
-
1582
- this._onCsvComplete = function()
1583
- {
1584
- // node will finish the read stream when
1585
- // null is pushed
1586
- stream.push(null);
1587
- };
1588
-
1589
- config.step = bindFunction(this._onCsvData, this);
1590
- config.complete = bindFunction(this._onCsvComplete, this);
1591
- ChunkStreamer.call(this, config);
1592
-
1593
- this._nextChunk = function()
1594
- {
1595
- if (writeStreamHasFinished && parseCallbackQueue.length === 1) {
1596
- this._finished = true;
1597
- }
1598
- if (parseCallbackQueue.length) {
1599
- parseCallbackQueue.shift()();
1600
- } else {
1601
- parseOnWrite = true;
1602
- }
1603
- };
1604
-
1605
- this._addToParseQueue = function(chunk, callback)
1606
- {
1607
- // add to queue so that we can indicate
1608
- // completion via callback
1609
- // node will automatically pause the incoming stream
1610
- // when too many items have been added without their
1611
- // callback being invoked
1612
- parseCallbackQueue.push(bindFunction(function() {
1613
- this.parseChunk(typeof chunk === 'string' ? chunk : chunk.toString(config.encoding));
1614
- if (isFunction(callback)) {
1615
- return callback();
1616
- }
1617
- }, this));
1618
- if (parseOnWrite) {
1619
- parseOnWrite = false;
1620
- this._nextChunk();
1621
- }
1622
- };
1623
-
1624
- this._onRead = function()
1625
- {
1626
- if (this._handle.paused()) {
1627
- // the writeable consumer can handle more data
1628
- // so resume the chunk parsing
1629
- this._handle.resume();
1630
- }
1631
- };
1632
-
1633
- this._onWrite = function(chunk, encoding, callback)
1634
- {
1635
- this._addToParseQueue(chunk, callback);
1636
- };
1637
-
1638
- this._onWriteComplete = function()
1639
- {
1640
- writeStreamHasFinished = true;
1641
- // have to write empty string
1642
- // so parser knows its done
1643
- this._addToParseQueue('');
1644
- };
1645
-
1646
- this.getStream = function()
1647
- {
1648
- return stream;
1649
- };
1650
- stream = new Duplex({
1651
- readableObjectMode: true,
1652
- decodeStrings: false,
1653
- read: bindFunction(this._onRead, this),
1654
- write: bindFunction(this._onWrite, this)
1655
- });
1656
- stream.once('finish', bindFunction(this._onWriteComplete, this));
1657
- }
1658
- if (typeof PAPA_BROWSER_CONTEXT === 'undefined') {
1659
- DuplexStreamStreamer.prototype = Object.create(ChunkStreamer.prototype);
1660
- DuplexStreamStreamer.prototype.constructor = DuplexStreamStreamer;
1661
- }
1662
-
1663
-
1664
- // Use one ParserHandle per entire CSV file or string
1665
- function ParserHandle(_config)
1666
- {
1667
- // One goal is to minimize the use of regular expressions...
1668
- var MAX_FLOAT = Math.pow(2, 53);
1669
- var MIN_FLOAT = -MAX_FLOAT;
1670
- var FLOAT = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/;
1671
- var ISO_DATE = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/;
1672
- var self = this;
1673
- var _stepCounter = 0; // Number of times step was called (number of rows parsed)
1674
- var _rowCounter = 0; // Number of rows that have been parsed so far
1675
- var _input; // The input being parsed
1676
- var _parser; // The core parser being used
1677
- var _paused = false; // Whether we are paused or not
1678
- var _aborted = false; // Whether the parser has aborted or not
1679
- var _delimiterError; // Temporary state between delimiter detection and processing results
1680
- var _fields = []; // Fields are from the header row of the input, if there is one
1681
- var _results = { // The last results returned from the parser
1682
- data: [],
1683
- errors: [],
1684
- meta: {}
1685
- };
1686
-
1687
- if (isFunction(_config.step))
1688
- {
1689
- var userStep = _config.step;
1690
- _config.step = function(results)
1691
- {
1692
- _results = results;
1693
-
1694
- if (needsHeaderRow())
1695
- processResults();
1696
- else // only call user's step function after header row
1697
- {
1698
- processResults();
1699
-
1700
- // It's possbile that this line was empty and there's no row here after all
1701
- if (_results.data.length === 0)
1702
- return;
1703
-
1704
- _stepCounter += results.data.length;
1705
- if (_config.preview && _stepCounter > _config.preview)
1706
- _parser.abort();
1707
- else {
1708
- _results.data = _results.data[0];
1709
- userStep(_results, self);
1710
- }
1711
- }
1712
- };
1713
- }
1714
-
1715
- /**
1716
- * Parses input. Most users won't need, and shouldn't mess with, the baseIndex
1717
- * and ignoreLastRow parameters. They are used by streamers (wrapper functions)
1718
- * when an input comes in multiple chunks, like from a file.
1719
- */
1720
- this.parse = function(input, baseIndex, ignoreLastRow)
1721
- {
1722
- var quoteChar = _config.quoteChar || '"';
1723
- if (!_config.newline)
1724
- _config.newline = guessLineEndings(input, quoteChar);
1725
-
1726
- _delimiterError = false;
1727
- if (!_config.delimiter)
1728
- {
1729
- var delimGuess = guessDelimiter(input, _config.newline, _config.skipEmptyLines, _config.comments, _config.delimitersToGuess);
1730
- if (delimGuess.successful)
1731
- _config.delimiter = delimGuess.bestDelimiter;
1732
- else
1733
- {
1734
- _delimiterError = true; // add error after parsing (otherwise it would be overwritten)
1735
- _config.delimiter = Papa.DefaultDelimiter;
1736
- }
1737
- _results.meta.delimiter = _config.delimiter;
1738
- }
1739
- else if(isFunction(_config.delimiter))
1740
- {
1741
- _config.delimiter = _config.delimiter(input);
1742
- _results.meta.delimiter = _config.delimiter;
1743
- }
1744
-
1745
- var parserConfig = copy(_config);
1746
- if (_config.preview && _config.header)
1747
- parserConfig.preview++; // to compensate for header row
1748
-
1749
- _input = input;
1750
- _parser = new Parser(parserConfig);
1751
- _results = _parser.parse(_input, baseIndex, ignoreLastRow);
1752
- processResults();
1753
- return _paused ? { meta: { paused: true } } : (_results || { meta: { paused: false } });
1754
- };
1755
-
1756
- this.paused = function()
1757
- {
1758
- return _paused;
1759
- };
1760
-
1761
- this.pause = function()
1762
- {
1763
- _paused = true;
1764
- _parser.abort();
1765
-
1766
- // If it is streaming via "chunking", the reader will start appending correctly already so no need to substring,
1767
- // otherwise we can get duplicate content within a row
1768
- _input = isFunction(_config.chunk) ? "" : _input.substring(_parser.getCharIndex());
1769
- };
1770
-
1771
- this.resume = function()
1772
- {
1773
- if(self.streamer._halted) {
1774
- _paused = false;
1775
- self.streamer.parseChunk(_input, true);
1776
- } else {
1777
- // Bugfix: #636 In case the processing hasn't halted yet
1778
- // wait for it to halt in order to resume
1779
- setTimeout(self.resume, 3);
1780
- }
1781
- };
1782
-
1783
- this.aborted = function()
1784
- {
1785
- return _aborted;
1786
- };
1787
-
1788
- this.abort = function()
1789
- {
1790
- _aborted = true;
1791
- _parser.abort();
1792
- _results.meta.aborted = true;
1793
- if (isFunction(_config.complete))
1794
- _config.complete(_results);
1795
- _input = '';
1796
- };
1797
-
1798
- function testEmptyLine(s) {
1799
- return _config.skipEmptyLines === 'greedy' ? s.join('').trim() === '' : s.length === 1 && s[0].length === 0;
1800
- }
1801
-
1802
- function testFloat(s) {
1803
- if (FLOAT.test(s)) {
1804
- var floatValue = parseFloat(s);
1805
- if (floatValue > MIN_FLOAT && floatValue < MAX_FLOAT) {
1806
- return true;
1807
- }
1808
- }
1809
- return false;
1810
- }
1811
-
1812
- function processResults()
1813
- {
1814
- if (_results && _delimiterError)
1815
- {
1816
- addError('Delimiter', 'UndetectableDelimiter', 'Unable to auto-detect delimiting character; defaulted to \'' + Papa.DefaultDelimiter + '\'');
1817
- _delimiterError = false;
1818
- }
1819
-
1820
- if (_config.skipEmptyLines)
1821
- {
1822
- _results.data = _results.data.filter(function(d) {
1823
- return !testEmptyLine(d);
1824
- });
1825
- }
1826
-
1827
- if (needsHeaderRow())
1828
- fillHeaderFields();
1829
-
1830
- return applyHeaderAndDynamicTypingAndTransformation();
1831
- }
1832
-
1833
- function needsHeaderRow()
1834
- {
1835
- return _config.header && _fields.length === 0;
1836
- }
1837
-
1838
- function fillHeaderFields()
1839
- {
1840
- if (!_results)
1841
- return;
1842
-
1843
- function addHeader(header, i)
1844
- {
1845
- if (isFunction(_config.transformHeader))
1846
- header = _config.transformHeader(header, i);
1847
-
1848
- _fields.push(header);
1849
- }
1850
-
1851
- if (Array.isArray(_results.data[0]))
1852
- {
1853
- for (var i = 0; needsHeaderRow() && i < _results.data.length; i++)
1854
- _results.data[i].forEach(addHeader);
1855
-
1856
- _results.data.splice(0, 1);
1857
- }
1858
- // if _results.data[0] is not an array, we are in a step where _results.data is the row.
1859
- else
1860
- _results.data.forEach(addHeader);
1861
- }
1862
-
1863
- function shouldApplyDynamicTyping(field) {
1864
- // Cache function values to avoid calling it for each row
1865
- if (_config.dynamicTypingFunction && _config.dynamicTyping[field] === undefined) {
1866
- _config.dynamicTyping[field] = _config.dynamicTypingFunction(field);
1867
- }
1868
- return (_config.dynamicTyping[field] || _config.dynamicTyping) === true;
1869
- }
1870
-
1871
- function parseDynamic(field, value)
1872
- {
1873
- if (shouldApplyDynamicTyping(field))
1874
- {
1875
- if (value === 'true' || value === 'TRUE')
1876
- return true;
1877
- else if (value === 'false' || value === 'FALSE')
1878
- return false;
1879
- else if (testFloat(value))
1880
- return parseFloat(value);
1881
- else if (ISO_DATE.test(value))
1882
- return new Date(value);
1883
- else
1884
- return (value === '' ? null : value);
1885
- }
1886
- return value;
1887
- }
1888
-
1889
- function applyHeaderAndDynamicTypingAndTransformation()
1890
- {
1891
- if (!_results || (!_config.header && !_config.dynamicTyping && !_config.transform))
1892
- return _results;
1893
-
1894
- function processRow(rowSource, i)
1895
- {
1896
- var row = _config.header ? {} : [];
1897
-
1898
- var j;
1899
- for (j = 0; j < rowSource.length; j++)
1900
- {
1901
- var field = j;
1902
- var value = rowSource[j];
1903
-
1904
- if (_config.header)
1905
- field = j >= _fields.length ? '__parsed_extra' : _fields[j];
1906
-
1907
- if (_config.transform)
1908
- value = _config.transform(value,field);
1909
-
1910
- value = parseDynamic(field, value);
1911
-
1912
- if (field === '__parsed_extra')
1913
- {
1914
- row[field] = row[field] || [];
1915
- row[field].push(value);
1916
- }
1917
- else
1918
- row[field] = value;
1919
- }
1920
-
1921
-
1922
- if (_config.header)
1923
- {
1924
- if (j > _fields.length)
1925
- addError('FieldMismatch', 'TooManyFields', 'Too many fields: expected ' + _fields.length + ' fields but parsed ' + j, _rowCounter + i);
1926
- else if (j < _fields.length)
1927
- addError('FieldMismatch', 'TooFewFields', 'Too few fields: expected ' + _fields.length + ' fields but parsed ' + j, _rowCounter + i);
1928
- }
1929
-
1930
- return row;
1931
- }
1932
-
1933
- var incrementBy = 1;
1934
- if (!_results.data.length || Array.isArray(_results.data[0]))
1935
- {
1936
- _results.data = _results.data.map(processRow);
1937
- incrementBy = _results.data.length;
1938
- }
1939
- else
1940
- _results.data = processRow(_results.data, 0);
1941
-
1942
-
1943
- if (_config.header && _results.meta)
1944
- _results.meta.fields = _fields;
1945
-
1946
- _rowCounter += incrementBy;
1947
- return _results;
1948
- }
1949
-
1950
- function guessDelimiter(input, newline, skipEmptyLines, comments, delimitersToGuess) {
1951
- var bestDelim, bestDelta, fieldCountPrevRow, maxFieldCount;
1952
-
1953
- delimitersToGuess = delimitersToGuess || [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP];
1954
-
1955
- for (var i = 0; i < delimitersToGuess.length; i++) {
1956
- var delim = delimitersToGuess[i];
1957
- var delta = 0, avgFieldCount = 0, emptyLinesCount = 0;
1958
- fieldCountPrevRow = undefined;
1959
-
1960
- var preview = new Parser({
1961
- comments: comments,
1962
- delimiter: delim,
1963
- newline: newline,
1964
- preview: 10
1965
- }).parse(input);
1966
-
1967
- for (var j = 0; j < preview.data.length; j++) {
1968
- if (skipEmptyLines && testEmptyLine(preview.data[j])) {
1969
- emptyLinesCount++;
1970
- continue;
1971
- }
1972
- var fieldCount = preview.data[j].length;
1973
- avgFieldCount += fieldCount;
1974
-
1975
- if (typeof fieldCountPrevRow === 'undefined') {
1976
- fieldCountPrevRow = fieldCount;
1977
- continue;
1978
- }
1979
- else if (fieldCount > 0) {
1980
- delta += Math.abs(fieldCount - fieldCountPrevRow);
1981
- fieldCountPrevRow = fieldCount;
1982
- }
1983
- }
1984
-
1985
- if (preview.data.length > 0)
1986
- avgFieldCount /= (preview.data.length - emptyLinesCount);
1987
-
1988
- if ((typeof bestDelta === 'undefined' || delta <= bestDelta)
1989
- && (typeof maxFieldCount === 'undefined' || avgFieldCount > maxFieldCount) && avgFieldCount > 1.99) {
1990
- bestDelta = delta;
1991
- bestDelim = delim;
1992
- maxFieldCount = avgFieldCount;
1993
- }
1994
- }
1995
-
1996
- _config.delimiter = bestDelim;
1997
-
1998
- return {
1999
- successful: !!bestDelim,
2000
- bestDelimiter: bestDelim
2001
- };
2002
- }
2003
-
2004
- function guessLineEndings(input, quoteChar)
2005
- {
2006
- input = input.substring(0, 1024 * 1024); // max length 1 MB
2007
- // Replace all the text inside quotes
2008
- var re = new RegExp(escapeRegExp(quoteChar) + '([^]*?)' + escapeRegExp(quoteChar), 'gm');
2009
- input = input.replace(re, '');
2010
-
2011
- var r = input.split('\r');
2012
-
2013
- var n = input.split('\n');
2014
-
2015
- var nAppearsFirst = (n.length > 1 && n[0].length < r[0].length);
2016
-
2017
- if (r.length === 1 || nAppearsFirst)
2018
- return '\n';
2019
-
2020
- var numWithN = 0;
2021
- for (var i = 0; i < r.length; i++)
2022
- {
2023
- if (r[i][0] === '\n')
2024
- numWithN++;
2025
- }
2026
-
2027
- return numWithN >= r.length / 2 ? '\r\n' : '\r';
2028
- }
2029
-
2030
- function addError(type, code, msg, row)
2031
- {
2032
- var error = {
2033
- type: type,
2034
- code: code,
2035
- message: msg
2036
- };
2037
- if(row !== undefined) {
2038
- error.row = row;
2039
- }
2040
- _results.errors.push(error);
2041
- }
2042
- }
2043
-
2044
- /** https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions */
2045
- function escapeRegExp(string)
2046
- {
2047
- return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
2048
- }
2049
-
2050
- /** The core parser implements speedy and correct CSV parsing */
2051
- function Parser(config)
2052
- {
2053
- // Unpack the config object
2054
- config = config || {};
2055
- var delim = config.delimiter;
2056
- var newline = config.newline;
2057
- var comments = config.comments;
2058
- var step = config.step;
2059
- var preview = config.preview;
2060
- var fastMode = config.fastMode;
2061
- var quoteChar;
2062
- if (config.quoteChar === undefined || config.quoteChar === null) {
2063
- quoteChar = '"';
2064
- } else {
2065
- quoteChar = config.quoteChar;
2066
- }
2067
- var escapeChar = quoteChar;
2068
- if (config.escapeChar !== undefined) {
2069
- escapeChar = config.escapeChar;
2070
- }
2071
-
2072
- // Delimiter must be valid
2073
- if (typeof delim !== 'string'
2074
- || Papa.BAD_DELIMITERS.indexOf(delim) > -1)
2075
- delim = ',';
2076
-
2077
- // Comment character must be valid
2078
- if (comments === delim)
2079
- throw new Error('Comment character same as delimiter');
2080
- else if (comments === true)
2081
- comments = '#';
2082
- else if (typeof comments !== 'string'
2083
- || Papa.BAD_DELIMITERS.indexOf(comments) > -1)
2084
- comments = false;
2085
-
2086
- // Newline must be valid: \r, \n, or \r\n
2087
- if (newline !== '\n' && newline !== '\r' && newline !== '\r\n')
2088
- newline = '\n';
2089
-
2090
- // We're gonna need these at the Parser scope
2091
- var cursor = 0;
2092
- var aborted = false;
2093
-
2094
- this.parse = function(input, baseIndex, ignoreLastRow)
2095
- {
2096
- // For some reason, in Chrome, this speeds things up (!?)
2097
- if (typeof input !== 'string')
2098
- throw new Error('Input must be a string');
2099
-
2100
- // We don't need to compute some of these every time parse() is called,
2101
- // but having them in a more local scope seems to perform better
2102
- var inputLen = input.length,
2103
- delimLen = delim.length,
2104
- newlineLen = newline.length,
2105
- commentsLen = comments.length;
2106
- var stepIsFunction = isFunction(step);
2107
-
2108
- // Establish starting state
2109
- cursor = 0;
2110
- var data = [], errors = [], row = [], lastCursor = 0;
2111
-
2112
- if (!input)
2113
- return returnable();
2114
-
2115
- // Rename headers if there are duplicates
2116
- if (config.header)
2117
- {
2118
- var firstLine = input.split(newline)[0];
2119
- var headers = firstLine.split(delim);
2120
- var separator = '_';
2121
- var headerMap = [];
2122
- var headerCount = {};
2123
- var duplicateHeaders = false;
2124
-
2125
- for (var j in headers) {
2126
- var header = headers[j];
2127
- if (isFunction(config.transformHeader))
2128
- header = config.transformHeader(header, j);
2129
- var headerName = header;
2130
-
2131
- var count = headerCount[header] || 0;
2132
- if (count > 0) {
2133
- duplicateHeaders = true;
2134
- headerName = header + separator + count;
2135
- }
2136
- headerCount[header] = count + 1;
2137
-
2138
- headerMap.push(headerName);
2139
- }
2140
- if (duplicateHeaders) {
2141
- var editedInput = input.split(newline);
2142
- editedInput[0] = headerMap.join(delim);
2143
- input = editedInput.join(newline);
2144
- }
2145
- }
2146
- if (fastMode || (fastMode !== false && input.indexOf(quoteChar) === -1))
2147
- {
2148
- var rows = input.split(newline);
2149
- for (var i = 0; i < rows.length; i++)
2150
- {
2151
- row = rows[i];
2152
- cursor += row.length;
2153
- if (i !== rows.length - 1)
2154
- cursor += newline.length;
2155
- else if (ignoreLastRow)
2156
- return returnable();
2157
- if (comments && row.substring(0, commentsLen) === comments)
2158
- continue;
2159
- if (stepIsFunction)
2160
- {
2161
- data = [];
2162
- pushRow(row.split(delim));
2163
- doStep();
2164
- if (aborted)
2165
- return returnable();
2166
- }
2167
- else
2168
- pushRow(row.split(delim));
2169
- if (preview && i >= preview)
2170
- {
2171
- data = data.slice(0, preview);
2172
- return returnable(true);
2173
- }
2174
- }
2175
- return returnable();
2176
- }
2177
-
2178
- var nextDelim = input.indexOf(delim, cursor);
2179
- var nextNewline = input.indexOf(newline, cursor);
2180
- var quoteCharRegex = new RegExp(escapeRegExp(escapeChar) + escapeRegExp(quoteChar), 'g');
2181
- var quoteSearch = input.indexOf(quoteChar, cursor);
2182
-
2183
- // Parser loop
2184
- for (;;)
2185
- {
2186
- // Field has opening quote
2187
- if (input[cursor] === quoteChar)
2188
- {
2189
- // Start our search for the closing quote where the cursor is
2190
- quoteSearch = cursor;
2191
-
2192
- // Skip the opening quote
2193
- cursor++;
2194
-
2195
- for (;;)
2196
- {
2197
- // Find closing quote
2198
- quoteSearch = input.indexOf(quoteChar, quoteSearch + 1);
2199
-
2200
- //No other quotes are found - no other delimiters
2201
- if (quoteSearch === -1)
2202
- {
2203
- if (!ignoreLastRow) {
2204
- // No closing quote... what a pity
2205
- errors.push({
2206
- type: 'Quotes',
2207
- code: 'MissingQuotes',
2208
- message: 'Quoted field unterminated',
2209
- row: data.length, // row has yet to be inserted
2210
- index: cursor
2211
- });
2212
- }
2213
- return finish();
2214
- }
2215
-
2216
- // Closing quote at EOF
2217
- if (quoteSearch === inputLen - 1)
2218
- {
2219
- var value = input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar);
2220
- return finish(value);
2221
- }
2222
-
2223
- // If this quote is escaped, it's part of the data; skip it
2224
- // If the quote character is the escape character, then check if the next character is the escape character
2225
- if (quoteChar === escapeChar && input[quoteSearch + 1] === escapeChar)
2226
- {
2227
- quoteSearch++;
2228
- continue;
2229
- }
2230
-
2231
- // If the quote character is not the escape character, then check if the previous character was the escape character
2232
- if (quoteChar !== escapeChar && quoteSearch !== 0 && input[quoteSearch - 1] === escapeChar)
2233
- {
2234
- continue;
2235
- }
2236
-
2237
- if(nextDelim !== -1 && nextDelim < (quoteSearch + 1)) {
2238
- nextDelim = input.indexOf(delim, (quoteSearch + 1));
2239
- }
2240
- if(nextNewline !== -1 && nextNewline < (quoteSearch + 1)) {
2241
- nextNewline = input.indexOf(newline, (quoteSearch + 1));
2242
- }
2243
- // Check up to nextDelim or nextNewline, whichever is closest
2244
- var checkUpTo = nextNewline === -1 ? nextDelim : Math.min(nextDelim, nextNewline);
2245
- var spacesBetweenQuoteAndDelimiter = extraSpaces(checkUpTo);
2246
-
2247
- // Closing quote followed by delimiter or 'unnecessary spaces + delimiter'
2248
- if (input.substr(quoteSearch + 1 + spacesBetweenQuoteAndDelimiter, delimLen) === delim)
2249
- {
2250
- row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));
2251
- cursor = quoteSearch + 1 + spacesBetweenQuoteAndDelimiter + delimLen;
2252
-
2253
- // If char after following delimiter is not quoteChar, we find next quote char position
2254
- if (input[quoteSearch + 1 + spacesBetweenQuoteAndDelimiter + delimLen] !== quoteChar)
2255
- {
2256
- quoteSearch = input.indexOf(quoteChar, cursor);
2257
- }
2258
- nextDelim = input.indexOf(delim, cursor);
2259
- nextNewline = input.indexOf(newline, cursor);
2260
- break;
2261
- }
2262
-
2263
- var spacesBetweenQuoteAndNewLine = extraSpaces(nextNewline);
2264
-
2265
- // Closing quote followed by newline or 'unnecessary spaces + newLine'
2266
- if (input.substring(quoteSearch + 1 + spacesBetweenQuoteAndNewLine, quoteSearch + 1 + spacesBetweenQuoteAndNewLine + newlineLen) === newline)
2267
- {
2268
- row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));
2269
- saveRow(quoteSearch + 1 + spacesBetweenQuoteAndNewLine + newlineLen);
2270
- nextDelim = input.indexOf(delim, cursor); // because we may have skipped the nextDelim in the quoted field
2271
- quoteSearch = input.indexOf(quoteChar, cursor); // we search for first quote in next line
2272
-
2273
- if (stepIsFunction)
2274
- {
2275
- doStep();
2276
- if (aborted)
2277
- return returnable();
2278
- }
2279
-
2280
- if (preview && data.length >= preview)
2281
- return returnable(true);
2282
-
2283
- break;
2284
- }
2285
-
2286
-
2287
- // Checks for valid closing quotes are complete (escaped quotes or quote followed by EOF/delimiter/newline) -- assume these quotes are part of an invalid text string
2288
- errors.push({
2289
- type: 'Quotes',
2290
- code: 'InvalidQuotes',
2291
- message: 'Trailing quote on quoted field is malformed',
2292
- row: data.length, // row has yet to be inserted
2293
- index: cursor
2294
- });
2295
-
2296
- quoteSearch++;
2297
- continue;
2298
-
2299
- }
2300
-
2301
- continue;
2302
- }
2303
-
2304
- // Comment found at start of new line
2305
- if (comments && row.length === 0 && input.substring(cursor, cursor + commentsLen) === comments)
2306
- {
2307
- if (nextNewline === -1) // Comment ends at EOF
2308
- return returnable();
2309
- cursor = nextNewline + newlineLen;
2310
- nextNewline = input.indexOf(newline, cursor);
2311
- nextDelim = input.indexOf(delim, cursor);
2312
- continue;
2313
- }
2314
-
2315
- // Next delimiter comes before next newline, so we've reached end of field
2316
- if (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1))
2317
- {
2318
- row.push(input.substring(cursor, nextDelim));
2319
- cursor = nextDelim + delimLen;
2320
- // we look for next delimiter char
2321
- nextDelim = input.indexOf(delim, cursor);
2322
- continue;
2323
- }
2324
-
2325
- // End of row
2326
- if (nextNewline !== -1)
2327
- {
2328
- row.push(input.substring(cursor, nextNewline));
2329
- saveRow(nextNewline + newlineLen);
2330
-
2331
- if (stepIsFunction)
2332
- {
2333
- doStep();
2334
- if (aborted)
2335
- return returnable();
2336
- }
2337
-
2338
- if (preview && data.length >= preview)
2339
- return returnable(true);
2340
-
2341
- continue;
2342
- }
2343
-
2344
- break;
2345
- }
2346
-
2347
-
2348
- return finish();
2349
-
2350
-
2351
- function pushRow(row)
2352
- {
2353
- data.push(row);
2354
- lastCursor = cursor;
2355
- }
2356
-
2357
- /**
2358
- * checks if there are extra spaces after closing quote and given index without any text
2359
- * if Yes, returns the number of spaces
2360
- */
2361
- function extraSpaces(index) {
2362
- var spaceLength = 0;
2363
- if (index !== -1) {
2364
- var textBetweenClosingQuoteAndIndex = input.substring(quoteSearch + 1, index);
2365
- if (textBetweenClosingQuoteAndIndex && textBetweenClosingQuoteAndIndex.trim() === '') {
2366
- spaceLength = textBetweenClosingQuoteAndIndex.length;
2367
- }
2368
- }
2369
- return spaceLength;
2370
- }
2371
-
2372
- /**
2373
- * Appends the remaining input from cursor to the end into
2374
- * row, saves the row, calls step, and returns the results.
2375
- */
2376
- function finish(value)
2377
- {
2378
- if (ignoreLastRow)
2379
- return returnable();
2380
- if (typeof value === 'undefined')
2381
- value = input.substring(cursor);
2382
- row.push(value);
2383
- cursor = inputLen; // important in case parsing is paused
2384
- pushRow(row);
2385
- if (stepIsFunction)
2386
- doStep();
2387
- return returnable();
2388
- }
2389
-
2390
- /**
2391
- * Appends the current row to the results. It sets the cursor
2392
- * to newCursor and finds the nextNewline. The caller should
2393
- * take care to execute user's step function and check for
2394
- * preview and end parsing if necessary.
2395
- */
2396
- function saveRow(newCursor)
2397
- {
2398
- cursor = newCursor;
2399
- pushRow(row);
2400
- row = [];
2401
- nextNewline = input.indexOf(newline, cursor);
2402
- }
2403
-
2404
- /** Returns an object with the results, errors, and meta. */
2405
- function returnable(stopped)
2406
- {
2407
- return {
2408
- data: data,
2409
- errors: errors,
2410
- meta: {
2411
- delimiter: delim,
2412
- linebreak: newline,
2413
- aborted: aborted,
2414
- truncated: !!stopped,
2415
- cursor: lastCursor + (baseIndex || 0)
2416
- }
2417
- };
2418
- }
2419
-
2420
- /** Executes the user's step function and resets data & errors. */
2421
- function doStep()
2422
- {
2423
- step(returnable());
2424
- data = [];
2425
- errors = [];
2426
- }
2427
- };
2428
-
2429
- /** Sets the abort flag */
2430
- this.abort = function()
2431
- {
2432
- aborted = true;
2433
- };
2434
-
2435
- /** Gets the cursor position */
2436
- this.getCharIndex = function()
2437
- {
2438
- return cursor;
2439
- };
2440
- }
2441
-
2442
-
2443
- function newWorker()
2444
- {
2445
- if (!Papa.WORKERS_SUPPORTED)
2446
- return false;
2447
-
2448
- var workerUrl = getWorkerBlob();
2449
- var w = new global.Worker(workerUrl);
2450
- w.onmessage = mainThreadReceivedMessage;
2451
- w.id = workerIdCounter++;
2452
- workers[w.id] = w;
2453
- return w;
2454
- }
2455
-
2456
- /** Callback when main thread receives a message */
2457
- function mainThreadReceivedMessage(e)
2458
- {
2459
- var msg = e.data;
2460
- var worker = workers[msg.workerId];
2461
- var aborted = false;
2462
-
2463
- if (msg.error)
2464
- worker.userError(msg.error, msg.file);
2465
- else if (msg.results && msg.results.data)
2466
- {
2467
- var abort = function() {
2468
- aborted = true;
2469
- completeWorker(msg.workerId, { data: [], errors: [], meta: { aborted: true } });
2470
- };
2471
-
2472
- var handle = {
2473
- abort: abort,
2474
- pause: notImplemented,
2475
- resume: notImplemented
2476
- };
2477
-
2478
- if (isFunction(worker.userStep))
2479
- {
2480
- for (var i = 0; i < msg.results.data.length; i++)
2481
- {
2482
- worker.userStep({
2483
- data: msg.results.data[i],
2484
- errors: msg.results.errors,
2485
- meta: msg.results.meta
2486
- }, handle);
2487
- if (aborted)
2488
- break;
2489
- }
2490
- delete msg.results; // free memory ASAP
2491
- }
2492
- else if (isFunction(worker.userChunk))
2493
- {
2494
- worker.userChunk(msg.results, handle, msg.file);
2495
- delete msg.results;
2496
- }
2497
- }
2498
-
2499
- if (msg.finished && !aborted)
2500
- completeWorker(msg.workerId, msg.results);
2501
- }
2502
-
2503
- function completeWorker(workerId, results) {
2504
- var worker = workers[workerId];
2505
- if (isFunction(worker.userComplete))
2506
- worker.userComplete(results);
2507
- worker.terminate();
2508
- delete workers[workerId];
2509
- }
2510
-
2511
- function notImplemented() {
2512
- throw new Error('Not implemented.');
2513
- }
2514
-
2515
- /** Callback when worker thread receives a message */
2516
- function workerThreadReceivedMessage(e)
2517
- {
2518
- var msg = e.data;
2519
-
2520
- if (typeof Papa.WORKER_ID === 'undefined' && msg)
2521
- Papa.WORKER_ID = msg.workerId;
2522
-
2523
- if (typeof msg.input === 'string')
2524
- {
2525
- global.postMessage({
2526
- workerId: Papa.WORKER_ID,
2527
- results: Papa.parse(msg.input, msg.config),
2528
- finished: true
2529
- });
2530
- }
2531
- else if ((global.File && msg.input instanceof File) || msg.input instanceof Object) // thank you, Safari (see issue #106)
2532
- {
2533
- var results = Papa.parse(msg.input, msg.config);
2534
- if (results)
2535
- global.postMessage({
2536
- workerId: Papa.WORKER_ID,
2537
- results: results,
2538
- finished: true
2539
- });
2540
- }
2541
- }
2542
-
2543
- /** Makes a deep copy of an array or object (mostly) */
2544
- function copy(obj)
2545
- {
2546
- if (typeof obj !== 'object' || obj === null)
2547
- return obj;
2548
- var cpy = Array.isArray(obj) ? [] : {};
2549
- for (var key in obj)
2550
- cpy[key] = copy(obj[key]);
2551
- return cpy;
2552
- }
2553
-
2554
- function bindFunction(f, self)
2555
- {
2556
- return function() { f.apply(self, arguments); };
2557
- }
2558
-
2559
- function isFunction(func)
2560
- {
2561
- return typeof func === 'function';
2562
- }
2563
-
2564
- return Papa;
2565
- }));
2566
- } (papaparse));
2567
-
2568
- var Papa = papaparse.exports;
2569
-
2570
- var isValidEmail = function isValidEmail(email) {
2571
- return string().email().isValidSync(email);
2572
- };
2573
- var createEmailOptions = function createEmailOptions() {
2574
- var emails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
2575
- return emails.map(function (email) {
2576
- return {
2577
- label: email,
2578
- value: email,
2579
- valid: isValidEmail(email)
2580
- };
2581
- });
2582
- };
2583
- var parseCsvEmails = /*#__PURE__*/function () {
2584
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(file, onSuccess) {
2585
- return regenerator.wrap(function _callee$(_context) {
2586
- while (1) switch (_context.prev = _context.next) {
2587
- case 0:
2588
- Papa.parse(file, {
2589
- header: true,
2590
- skipEmptyLines: true,
2591
- transformHeader: function transformHeader(h) {
2592
- return h.toLowerCase().replace(/\W/g, "");
2593
- },
2594
- complete: function complete(results) {
2595
- var _results$meta$fields;
2596
- var isEmailFieldPresent = (_results$meta$fields = results.meta.fields) === null || _results$meta$fields === void 0 ? void 0 : _results$meta$fields.includes("email");
2597
- if (isEmailFieldPresent) {
2598
- var emails = results.data.filter(prop("email")).map(function (item) {
2599
- return item.email.trim();
2600
- });
2601
- onSuccess(createEmailOptions(emails));
2602
- } else {
2603
- Toastr.error(t("neetoMolecules.sendToFields.errors.invalidCsv"));
2604
- }
2605
- }
2606
- });
2607
- case 1:
2608
- case "end":
2609
- return _context.stop();
2610
- }
2611
- }, _callee);
2612
- }));
2613
- return function parseCsvEmails(_x, _x2) {
2614
- return _ref.apply(this, arguments);
2615
- };
2616
- }();
2617
-
2618
- var SendToFields = function SendToFields(_ref) {
2619
- var emailInputProps = _ref.emailInputProps,
2620
- ccInputProps = _ref.ccInputProps,
2621
- bccInputProps = _ref.bccInputProps,
2622
- _ref$showUploadCsvBut = _ref.showUploadCsvButton,
2623
- showUploadCsvButton = _ref$showUploadCsvBut === void 0 ? false : _ref$showUploadCsvBut,
2624
- _ref$showCcBccButton = _ref.showCcBccButton,
2625
- showCcBccButton = _ref$showCcBccButton === void 0 ? false : _ref$showCcBccButton;
2626
- var sendToFieldRef = useRef();
2627
- var _useFormikContext = useFormikContext(),
2628
- _useFormikContext$val = _useFormikContext.values,
2629
- showCopyEmails = _useFormikContext$val.showCopyEmails,
2630
- existingSendToEmails = _useFormikContext$val[emailInputProps.name || "sendTo"],
2631
- setFieldValue = _useFormikContext.setFieldValue;
2632
- var _useTranslation = useTranslation(),
2633
- t = _useTranslation.t;
2634
- var handleCSVFile = /*#__PURE__*/function () {
2635
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(files) {
2636
- var _sendToFieldRef$curre, onSuccess;
2637
- return regenerator.wrap(function _callee$(_context) {
2638
- while (1) switch (_context.prev = _context.next) {
2639
- case 0:
2640
- _context.prev = 0;
2641
- onSuccess = function onSuccess(values) {
2642
- return setFieldValue(emailInputProps.name || "sendTo", [].concat(_toConsumableArray(existingSendToEmails), _toConsumableArray(values)));
2643
- };
2644
- _context.next = 4;
2645
- return parseCsvEmails(files[0], onSuccess);
2646
- case 4:
2647
- (_sendToFieldRef$curre = sendToFieldRef.current) === null || _sendToFieldRef$curre === void 0 ? void 0 : _sendToFieldRef$curre.focus();
2648
- _context.next = 10;
2649
- break;
2650
- case 7:
2651
- _context.prev = 7;
2652
- _context.t0 = _context["catch"](0);
2653
- Toastr.error(_context.t0);
2654
- case 10:
2655
- case "end":
2656
- return _context.stop();
2657
- }
2658
- }, _callee, null, [[0, 7]]);
2659
- }));
2660
- return function handleCSVFile(_x) {
2661
- return _ref2.apply(this, arguments);
2662
- };
2663
- }();
2664
- var handelCcBccButtonClick = function handelCcBccButtonClick(e) {
2665
- e.stopPropagation();
2666
- setFieldValue("showCopyEmails", !showCopyEmails);
2667
- };
2668
- return /*#__PURE__*/React.createElement("div", {
2669
- className: "relative w-full flex-col gap-2"
2670
- }, showUploadCsvButton && /*#__PURE__*/React.createElement("div", {
2671
- className: "absolute top-0 right-1"
2672
- }, /*#__PURE__*/React.createElement(FilePicker, {
2673
- types: ALLOWED_FILE_PICKER_TYPES,
2674
- onChange: handleCSVFile
2675
- }, /*#__PURE__*/React.createElement(Button, {
2676
- "data-cy": "upload-csv-button",
2677
- icon: Upload,
2678
- label: t("neetoMolecules.emailForm.uploadCSV"),
2679
- size: "small",
2680
- style: "link",
2681
- tooltipProps: {
2682
- content: t("neetoMolecules.sendToFields.uploadCsvTooltip"),
2683
- position: "right"
2684
- }
2685
- }))), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
2686
- "data-testid": "emails",
2687
- name: "sendTo",
2688
- ref: sendToFieldRef
2689
- }, emailInputProps, {
2690
- suffix: showCcBccButton && /*#__PURE__*/React.createElement(Button, {
2691
- "data-cy": "cc-bcc-button",
2692
- "data-testid": "cc-bcc-button",
2693
- label: t("neetoMolecules.emailForm.labels.ccBcc"),
2694
- size: "small",
2695
- style: "link",
2696
- onClick: handelCcBccButtonClick
2697
- })
2698
- })), showCopyEmails && /*#__PURE__*/React.createElement("div", {
2699
- className: "mt-5 flex w-full flex-col gap-6"
2700
- }, /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
2701
- name: "sendToBcc"
2702
- }, ccInputProps)), /*#__PURE__*/React.createElement(MultiEmailInput, _extends({
2703
- name: "sendToCc"
2704
- }, bccInputProps))));
2705
- };
2706
-
2707
- var SendToField = withT(function (_ref) {
2708
- var t = _ref.t;
2709
- return /*#__PURE__*/React.createElement(SendToFields, {
2710
- showCcBccButton: true,
2711
- showUploadCsvButton: true,
2712
- bccInputProps: {
2713
- label: t("neetoMolecules.emailForm.labels.bCc"),
2714
- name: "sendToBcc",
2715
- placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
2716
- },
2717
- ccInputProps: {
2718
- label: t("neetoMolecules.emailForm.labels.cc"),
2719
- name: "sendToCc",
2720
- placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
2721
- },
2722
- emailInputProps: {
2723
- id: "sendTo",
2724
- name: "sendTo",
2725
- label: t("neetoMolecules.emailForm.labels.sendTo"),
2726
- placeholder: t("neetoMolecules.emailForm.placeholders.commaSeparatedEmails")
2727
- }
2728
- });
2729
- });
2730
-
2731
- function _arrayWithHoles(arr) {
2732
- if (Array.isArray(arr)) return arr;
2733
- }
2734
-
2735
- function _iterableToArrayLimit(arr, i) {
2736
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
2737
- if (null != _i) {
2738
- var _s,
2739
- _e,
2740
- _x,
2741
- _r,
2742
- _arr = [],
2743
- _n = !0,
2744
- _d = !1;
2745
- try {
2746
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
2747
- if (Object(_i) !== _i) return;
2748
- _n = !1;
2749
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
2750
- } catch (err) {
2751
- _d = !0, _e = err;
2752
- } finally {
2753
- try {
2754
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
2755
- } finally {
2756
- if (_d) throw _e;
2757
- }
2758
- }
2759
- return _arr;
2760
- }
2761
- }
2762
-
2763
- function _nonIterableRest() {
2764
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2765
- }
2766
-
2767
- function _slicedToArray(arr, i) {
2768
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
2769
- }
2770
-
2771
- var SubjectField = function SubjectField(_ref) {
2772
- var name = _ref.name,
2773
- text = _ref.text,
2774
- updateText = _ref.updateText,
2775
- _ref$subjectVariables = _ref.subjectVariables,
2776
- subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
2777
- error = _ref.error,
2778
- _ref$required = _ref.required,
2779
- required = _ref$required === void 0 ? false : _ref$required;
2780
- var _useState = useState(false),
2781
- _useState2 = _slicedToArray(_useState, 2),
2782
- isFieldFocusedOnce = _useState2[0],
2783
- setIsFieldFocusedOnce = _useState2[1];
2784
- var _useTranslation = useTranslation(),
2785
- t = _useTranslation.t;
2786
- var tagClickHandler = function tagClickHandler(_ref2) {
2787
- var slug = _ref2.key;
2788
- var textAreaElement = document.querySelector("textarea[name=".concat(name, "]"));
2789
- var splitIndex = isFieldFocusedOnce && textAreaElement ? textAreaElement.selectionEnd : text.length;
2790
- var updatedSubject = [text.slice(0, splitIndex), " {{".concat(slug, "}}"), text.slice(splitIndex)].join("");
2791
- updateText(updatedSubject);
2792
- };
2793
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input$1, {
2794
- error: error,
2795
- name: name,
2796
- required: required,
2797
- label: t("neetoMolecules.emailForm.labels.subject"),
2798
- size: "large",
2799
- value: text,
2800
- suffix: /*#__PURE__*/React.createElement(DynamicVariables, {
2801
- variables: subjectVariables,
2802
- dropdownProps: {
2803
- className: "neeto-ui-dropdown__popup overflow-y-auto",
2804
- buttonSize: "small"
2805
- },
2806
- onVariableClick: tagClickHandler
2807
- }),
2808
- onChange: withEventTargetValue(updateText),
2809
- onFocus: function onFocus() {
2810
- return setIsFieldFocusedOnce(true);
2811
- }
2812
- }), /*#__PURE__*/React.createElement(Typography, {
2813
- className: "neeto-ui-text-gray-600 mt-2",
2814
- "data-cy": "subject-input-variable-label",
2815
- style: "body3"
2816
- }, /*#__PURE__*/React.createElement(Trans, {
2817
- components: {
2818
- span: /*#__PURE__*/React.createElement("span", {
2819
- className: "font-semibold"
2820
- })
2821
- },
2822
- i18nKey: "neetoMolecules.emailForm.helpText",
2823
- values: {
2824
- type: "subject"
2825
- }
2826
- })));
2827
- };
2828
-
2829
- var EmailForm = function EmailForm(_ref) {
2830
- var _ref$messageVariables = _ref.messageVariables,
2831
- messageVariables = _ref$messageVariables === void 0 ? [] : _ref$messageVariables,
2832
- _ref$subjectVariables = _ref.subjectVariables,
2833
- subjectVariables = _ref$subjectVariables === void 0 ? [] : _ref$subjectVariables,
2834
- handleCancel = _ref.handleCancel,
2835
- isLoading = _ref.isLoading,
2836
- _ref$replyToOptions = _ref.replyToOptions,
2837
- replyToOptions = _ref$replyToOptions === void 0 ? [] : _ref$replyToOptions,
2838
- _ref$isUpdating = _ref.isUpdating,
2839
- isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating,
2840
- _ref$showFields = _ref.showFields,
2841
- showFields = _ref$showFields === void 0 ? true : _ref$showFields,
2842
- _ref$className = _ref.className,
2843
- className = _ref$className === void 0 ? "" : _ref$className;
2844
- var _useTranslation = useTranslation(),
2845
- t = _useTranslation.t;
2846
- var _useContext = useContext(EmailFormContext),
2847
- showSendToField = _useContext.showSendToField,
2848
- showReplyToField = _useContext.showReplyToField;
2849
- var _useFormikContext = useFormikContext(),
2850
- setFieldValue = _useFormikContext.setFieldValue,
2851
- dirty = _useFormikContext.dirty;
2852
- return /*#__PURE__*/React.createElement("div", {
2853
- "data-testid": "email-form",
2854
- className: classnames("flex flex-1 flex-col items-start gap-2", _defineProperty({}, className, className))
2855
- }, showFields && /*#__PURE__*/React.createElement("div", {
2856
- className: "flex w-full flex-col items-start justify-start gap-6"
2857
- }, /*#__PURE__*/React.createElement(Field, {
2858
- name: "subject"
2859
- }, function (_ref2) {
2860
- var value = _ref2.field.value,
2861
- error = _ref2.meta.error;
2862
- return /*#__PURE__*/React.createElement("div", {
2863
- className: "w-full"
2864
- }, /*#__PURE__*/React.createElement(SubjectField, {
2865
- error: t(error),
2866
- name: "subject",
2867
- subjectVariables: subjectVariables,
2868
- text: value,
2869
- updateText: function updateText(text) {
2870
- return setFieldValue("subject", text);
2871
- }
2872
- }));
2873
- }), showSendToField && /*#__PURE__*/React.createElement(SendToField, null), showReplyToField && /*#__PURE__*/React.createElement(ReplyToField, {
2874
- replyToOptions: replyToOptions
2875
- }), /*#__PURE__*/React.createElement("div", {
2876
- className: "w-full"
2877
- }, /*#__PURE__*/React.createElement(FormikEditor, {
2878
- required: true,
2879
- addons: EDITOR_ADDONS,
2880
- "data-cy": "message-input-field",
2881
- id: "form_message",
2882
- label: t("neetoMolecules.emailForm.labels.message"),
2883
- name: "message",
2884
- variables: messageVariables
2885
- }), /*#__PURE__*/React.createElement(Typography, {
2886
- className: "neeto-ui-text-gray-500 mt-2",
2887
- "data-cy": "message-input-variable-label",
2888
- style: "body3"
2889
- }, /*#__PURE__*/React.createElement(Trans, {
2890
- i18nKey: "neetoMolecules.emailForm.helpText",
2891
- values: {
2892
- type: "message"
2893
- },
2894
- components: {
2895
- span: /*#__PURE__*/React.createElement("span", {
2896
- className: "font-semibold"
2897
- })
2898
- }
2899
- })))), /*#__PURE__*/React.createElement(ActionBlock, {
2900
- className: "mt-6 w-full justify-start",
2901
- cancelButtonProps: {
2902
- disabled: false,
2903
- onClick: handleCancel,
2904
- className: "ml-3"
2905
- },
2906
- submitButtonProps: {
2907
- loading: isLoading,
2908
- disabled: !dirty || isUpdating
2909
- }
2910
- }));
2911
- };
2912
-
2913
- var getValidationSchema = function getValidationSchema(_ref) {
2914
- var showSendToField = _ref.showSendToField,
2915
- showReplyToField = _ref.showReplyToField,
2916
- customValidations = _ref.customValidations;
2917
- var schema = EMAIL_FORM_VALIDATION_SCHEMA.clone();
2918
- if (showSendToField) schema = schema.concat(SEND_TO_FIELD_VALIDATION);
2919
- if (showReplyToField) schema = schema.concat(REPLY_TO_FIELD_VALIDATION);
2920
- return schema.shape(customValidations);
2921
- };
2922
-
2923
- 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; }
2924
- 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; }
2925
- var EmailFormProvider = function EmailFormProvider(_ref) {
2926
- var _ref$onSubmit = _ref.onSubmit,
2927
- onSubmit = _ref$onSubmit === void 0 ? noop : _ref$onSubmit,
2928
- _ref$initialValues = _ref.initialValues,
2929
- initialValues = _ref$initialValues === void 0 ? INITIAL_FORM_VALUES : _ref$initialValues,
2930
- children = _ref.children,
2931
- formikProps = _ref.formikProps,
2932
- _ref$validationSchema = _ref.validationSchema,
2933
- customValidations = _ref$validationSchema === void 0 ? {} : _ref$validationSchema,
2934
- _ref$showSendToField = _ref.showSendToField,
2935
- showSendToField = _ref$showSendToField === void 0 ? false : _ref$showSendToField,
2936
- _ref$showReplyToField = _ref.showReplyToField,
2937
- showReplyToField = _ref$showReplyToField === void 0 ? false : _ref$showReplyToField;
2938
- return /*#__PURE__*/React.createElement("div", {
2939
- "data-testid": "email-form-provider"
2940
- }, /*#__PURE__*/React.createElement(EmailFormContext.Provider, {
2941
- value: {
2942
- showSendToField: showSendToField,
2943
- showReplyToField: showReplyToField
2944
- }
2945
- }, /*#__PURE__*/React.createElement(Form, {
2946
- formikProps: _objectSpread({
2947
- enableReinitialize: true,
2948
- validationSchema: getValidationSchema({
2949
- showSendToField: showSendToField,
2950
- showReplyToField: showReplyToField,
2951
- customValidations: customValidations
2952
- }),
2953
- initialValues: _objectSpread(_objectSpread({}, initialValues), {}, {
2954
- replyTo: initialValues.replyTo || globalProps.user.email
2955
- }),
2956
- onSubmit: onSubmit
2957
- }, formikProps)
2958
- }, children)));
2959
- };
2960
-
2961
- var propTypes = {exports: {}};
2962
-
2963
- var reactIs = {exports: {}};
2964
-
2965
- var reactIs_production_min = {};
2966
-
2967
- /** @license React v16.13.1
2968
- * react-is.production.min.js
2969
- *
2970
- * Copyright (c) Facebook, Inc. and its affiliates.
2971
- *
2972
- * This source code is licensed under the MIT license found in the
2973
- * LICENSE file in the root directory of this source tree.
2974
- */
2975
-
2976
- var hasRequiredReactIs_production_min;
2977
-
2978
- function requireReactIs_production_min () {
2979
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
2980
- hasRequiredReactIs_production_min = 1;
2981
- 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?
2982
- 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;
2983
- 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;
2984
- 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};
2985
- 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};
2986
- 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;
2987
- return reactIs_production_min;
2988
- }
2989
-
2990
- var reactIs_development = {};
2991
-
2992
- /** @license React v16.13.1
2993
- * react-is.development.js
2994
- *
2995
- * Copyright (c) Facebook, Inc. and its affiliates.
2996
- *
2997
- * This source code is licensed under the MIT license found in the
2998
- * LICENSE file in the root directory of this source tree.
2999
- */
3000
-
3001
- var hasRequiredReactIs_development;
3002
-
3003
- function requireReactIs_development () {
3004
- if (hasRequiredReactIs_development) return reactIs_development;
3005
- hasRequiredReactIs_development = 1;
3006
-
3007
-
3008
-
3009
- if (process.env.NODE_ENV !== "production") {
3010
- (function() {
3011
-
3012
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
3013
- // nor polyfill, then a plain number is used for performance.
3014
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
3015
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
3016
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
3017
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
3018
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
3019
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
3020
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
3021
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
3022
- // (unstable) APIs that have been removed. Can we remove the symbols?
3023
-
3024
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
3025
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
3026
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
3027
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
3028
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
3029
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
3030
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
3031
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
3032
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
3033
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
3034
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
3035
-
3036
- function isValidElementType(type) {
3037
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
3038
- 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);
3039
- }
3040
-
3041
- function typeOf(object) {
3042
- if (typeof object === 'object' && object !== null) {
3043
- var $$typeof = object.$$typeof;
3044
-
3045
- switch ($$typeof) {
3046
- case REACT_ELEMENT_TYPE:
3047
- var type = object.type;
3048
-
3049
- switch (type) {
3050
- case REACT_ASYNC_MODE_TYPE:
3051
- case REACT_CONCURRENT_MODE_TYPE:
3052
- case REACT_FRAGMENT_TYPE:
3053
- case REACT_PROFILER_TYPE:
3054
- case REACT_STRICT_MODE_TYPE:
3055
- case REACT_SUSPENSE_TYPE:
3056
- return type;
3057
-
3058
- default:
3059
- var $$typeofType = type && type.$$typeof;
3060
-
3061
- switch ($$typeofType) {
3062
- case REACT_CONTEXT_TYPE:
3063
- case REACT_FORWARD_REF_TYPE:
3064
- case REACT_LAZY_TYPE:
3065
- case REACT_MEMO_TYPE:
3066
- case REACT_PROVIDER_TYPE:
3067
- return $$typeofType;
3068
-
3069
- default:
3070
- return $$typeof;
3071
- }
3072
-
3073
- }
3074
-
3075
- case REACT_PORTAL_TYPE:
3076
- return $$typeof;
3077
- }
3078
- }
3079
-
3080
- return undefined;
3081
- } // AsyncMode is deprecated along with isAsyncMode
3082
-
3083
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
3084
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
3085
- var ContextConsumer = REACT_CONTEXT_TYPE;
3086
- var ContextProvider = REACT_PROVIDER_TYPE;
3087
- var Element = REACT_ELEMENT_TYPE;
3088
- var ForwardRef = REACT_FORWARD_REF_TYPE;
3089
- var Fragment = REACT_FRAGMENT_TYPE;
3090
- var Lazy = REACT_LAZY_TYPE;
3091
- var Memo = REACT_MEMO_TYPE;
3092
- var Portal = REACT_PORTAL_TYPE;
3093
- var Profiler = REACT_PROFILER_TYPE;
3094
- var StrictMode = REACT_STRICT_MODE_TYPE;
3095
- var Suspense = REACT_SUSPENSE_TYPE;
3096
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
3097
-
3098
- function isAsyncMode(object) {
3099
- {
3100
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
3101
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
3102
-
3103
- 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.');
3104
- }
3105
- }
3106
-
3107
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
3108
- }
3109
- function isConcurrentMode(object) {
3110
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
3111
- }
3112
- function isContextConsumer(object) {
3113
- return typeOf(object) === REACT_CONTEXT_TYPE;
3114
- }
3115
- function isContextProvider(object) {
3116
- return typeOf(object) === REACT_PROVIDER_TYPE;
3117
- }
3118
- function isElement(object) {
3119
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
3120
- }
3121
- function isForwardRef(object) {
3122
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
3123
- }
3124
- function isFragment(object) {
3125
- return typeOf(object) === REACT_FRAGMENT_TYPE;
3126
- }
3127
- function isLazy(object) {
3128
- return typeOf(object) === REACT_LAZY_TYPE;
3129
- }
3130
- function isMemo(object) {
3131
- return typeOf(object) === REACT_MEMO_TYPE;
3132
- }
3133
- function isPortal(object) {
3134
- return typeOf(object) === REACT_PORTAL_TYPE;
3135
- }
3136
- function isProfiler(object) {
3137
- return typeOf(object) === REACT_PROFILER_TYPE;
3138
- }
3139
- function isStrictMode(object) {
3140
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
3141
- }
3142
- function isSuspense(object) {
3143
- return typeOf(object) === REACT_SUSPENSE_TYPE;
3144
- }
3145
-
3146
- reactIs_development.AsyncMode = AsyncMode;
3147
- reactIs_development.ConcurrentMode = ConcurrentMode;
3148
- reactIs_development.ContextConsumer = ContextConsumer;
3149
- reactIs_development.ContextProvider = ContextProvider;
3150
- reactIs_development.Element = Element;
3151
- reactIs_development.ForwardRef = ForwardRef;
3152
- reactIs_development.Fragment = Fragment;
3153
- reactIs_development.Lazy = Lazy;
3154
- reactIs_development.Memo = Memo;
3155
- reactIs_development.Portal = Portal;
3156
- reactIs_development.Profiler = Profiler;
3157
- reactIs_development.StrictMode = StrictMode;
3158
- reactIs_development.Suspense = Suspense;
3159
- reactIs_development.isAsyncMode = isAsyncMode;
3160
- reactIs_development.isConcurrentMode = isConcurrentMode;
3161
- reactIs_development.isContextConsumer = isContextConsumer;
3162
- reactIs_development.isContextProvider = isContextProvider;
3163
- reactIs_development.isElement = isElement;
3164
- reactIs_development.isForwardRef = isForwardRef;
3165
- reactIs_development.isFragment = isFragment;
3166
- reactIs_development.isLazy = isLazy;
3167
- reactIs_development.isMemo = isMemo;
3168
- reactIs_development.isPortal = isPortal;
3169
- reactIs_development.isProfiler = isProfiler;
3170
- reactIs_development.isStrictMode = isStrictMode;
3171
- reactIs_development.isSuspense = isSuspense;
3172
- reactIs_development.isValidElementType = isValidElementType;
3173
- reactIs_development.typeOf = typeOf;
3174
- })();
3175
- }
3176
- return reactIs_development;
3177
- }
3178
-
3179
- var hasRequiredReactIs;
3180
-
3181
- function requireReactIs () {
3182
- if (hasRequiredReactIs) return reactIs.exports;
3183
- hasRequiredReactIs = 1;
3184
- (function (module) {
3185
-
3186
- if (process.env.NODE_ENV === 'production') {
3187
- module.exports = requireReactIs_production_min();
3188
- } else {
3189
- module.exports = requireReactIs_development();
3190
- }
3191
- } (reactIs));
3192
- return reactIs.exports;
3193
- }
3194
-
3195
- /*
3196
- object-assign
3197
- (c) Sindre Sorhus
3198
- @license MIT
3199
- */
3200
-
3201
- var objectAssign;
3202
- var hasRequiredObjectAssign;
3203
-
3204
- function requireObjectAssign () {
3205
- if (hasRequiredObjectAssign) return objectAssign;
3206
- hasRequiredObjectAssign = 1;
3207
- /* eslint-disable no-unused-vars */
3208
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
3209
- var hasOwnProperty = Object.prototype.hasOwnProperty;
3210
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
3211
-
3212
- function toObject(val) {
3213
- if (val === null || val === undefined) {
3214
- throw new TypeError('Object.assign cannot be called with null or undefined');
3215
- }
3216
-
3217
- return Object(val);
3218
- }
3219
-
3220
- function shouldUseNative() {
3221
- try {
3222
- if (!Object.assign) {
3223
- return false;
3224
- }
3225
-
3226
- // Detect buggy property enumeration order in older V8 versions.
3227
-
3228
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
3229
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
3230
- test1[5] = 'de';
3231
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
3232
- return false;
3233
- }
3234
-
3235
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3236
- var test2 = {};
3237
- for (var i = 0; i < 10; i++) {
3238
- test2['_' + String.fromCharCode(i)] = i;
3239
- }
3240
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
3241
- return test2[n];
3242
- });
3243
- if (order2.join('') !== '0123456789') {
3244
- return false;
3245
- }
3246
-
3247
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3248
- var test3 = {};
3249
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
3250
- test3[letter] = letter;
3251
- });
3252
- if (Object.keys(Object.assign({}, test3)).join('') !==
3253
- 'abcdefghijklmnopqrst') {
3254
- return false;
3255
- }
3256
-
3257
- return true;
3258
- } catch (err) {
3259
- // We don't expect any of the above to throw, but better to be safe.
3260
- return false;
3261
- }
3262
- }
3263
-
3264
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
3265
- var from;
3266
- var to = toObject(target);
3267
- var symbols;
3268
-
3269
- for (var s = 1; s < arguments.length; s++) {
3270
- from = Object(arguments[s]);
3271
-
3272
- for (var key in from) {
3273
- if (hasOwnProperty.call(from, key)) {
3274
- to[key] = from[key];
3275
- }
3276
- }
3277
-
3278
- if (getOwnPropertySymbols) {
3279
- symbols = getOwnPropertySymbols(from);
3280
- for (var i = 0; i < symbols.length; i++) {
3281
- if (propIsEnumerable.call(from, symbols[i])) {
3282
- to[symbols[i]] = from[symbols[i]];
3283
- }
3284
- }
3285
- }
3286
- }
3287
-
3288
- return to;
3289
- };
3290
- return objectAssign;
3291
- }
3292
-
3293
- /**
3294
- * Copyright (c) 2013-present, Facebook, Inc.
3295
- *
3296
- * This source code is licensed under the MIT license found in the
3297
- * LICENSE file in the root directory of this source tree.
3298
- */
3299
-
3300
- var ReactPropTypesSecret_1;
3301
- var hasRequiredReactPropTypesSecret;
3302
-
3303
- function requireReactPropTypesSecret () {
3304
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
3305
- hasRequiredReactPropTypesSecret = 1;
3306
-
3307
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
3308
-
3309
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
3310
- return ReactPropTypesSecret_1;
3311
- }
3312
-
3313
- var has;
3314
- var hasRequiredHas;
3315
-
3316
- function requireHas () {
3317
- if (hasRequiredHas) return has;
3318
- hasRequiredHas = 1;
3319
- has = Function.call.bind(Object.prototype.hasOwnProperty);
3320
- return has;
3321
- }
3322
-
3323
- /**
3324
- * Copyright (c) 2013-present, Facebook, Inc.
3325
- *
3326
- * This source code is licensed under the MIT license found in the
3327
- * LICENSE file in the root directory of this source tree.
3328
- */
3329
-
3330
- var checkPropTypes_1;
3331
- var hasRequiredCheckPropTypes;
3332
-
3333
- function requireCheckPropTypes () {
3334
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
3335
- hasRequiredCheckPropTypes = 1;
3336
-
3337
- var printWarning = function() {};
3338
-
3339
- if (process.env.NODE_ENV !== 'production') {
3340
- var ReactPropTypesSecret = requireReactPropTypesSecret();
3341
- var loggedTypeFailures = {};
3342
- var has = requireHas();
3343
-
3344
- printWarning = function(text) {
3345
- var message = 'Warning: ' + text;
3346
- if (typeof console !== 'undefined') {
3347
- console.error(message);
3348
- }
3349
- try {
3350
- // --- Welcome to debugging React ---
3351
- // This error was thrown as a convenience so that you can use this stack
3352
- // to find the callsite that caused this warning to fire.
3353
- throw new Error(message);
3354
- } catch (x) { /**/ }
3355
- };
3356
- }
3357
-
3358
- /**
3359
- * Assert that the values match with the type specs.
3360
- * Error messages are memorized and will only be shown once.
3361
- *
3362
- * @param {object} typeSpecs Map of name to a ReactPropType
3363
- * @param {object} values Runtime values that need to be type-checked
3364
- * @param {string} location e.g. "prop", "context", "child context"
3365
- * @param {string} componentName Name of the component for error messages.
3366
- * @param {?Function} getStack Returns the component stack.
3367
- * @private
3368
- */
3369
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
3370
- if (process.env.NODE_ENV !== 'production') {
3371
- for (var typeSpecName in typeSpecs) {
3372
- if (has(typeSpecs, typeSpecName)) {
3373
- var error;
3374
- // Prop type validation may throw. In case they do, we don't want to
3375
- // fail the render phase where it didn't fail before. So we log it.
3376
- // After these have been cleaned up, we'll let them throw.
3377
- try {
3378
- // This is intentionally an invariant that gets caught. It's the same
3379
- // behavior as without this statement except with a better message.
3380
- if (typeof typeSpecs[typeSpecName] !== 'function') {
3381
- var err = Error(
3382
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
3383
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
3384
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
3385
- );
3386
- err.name = 'Invariant Violation';
3387
- throw err;
3388
- }
3389
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
3390
- } catch (ex) {
3391
- error = ex;
3392
- }
3393
- if (error && !(error instanceof Error)) {
3394
- printWarning(
3395
- (componentName || 'React class') + ': type specification of ' +
3396
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
3397
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
3398
- 'You may have forgotten to pass an argument to the type checker ' +
3399
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
3400
- 'shape all require an argument).'
3401
- );
3402
- }
3403
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
3404
- // Only monitor this failure once because there tends to be a lot of the
3405
- // same error.
3406
- loggedTypeFailures[error.message] = true;
3407
-
3408
- var stack = getStack ? getStack() : '';
3409
-
3410
- printWarning(
3411
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
3412
- );
3413
- }
3414
- }
3415
- }
3416
- }
3417
- }
3418
-
3419
- /**
3420
- * Resets warning cache when testing.
3421
- *
3422
- * @private
3423
- */
3424
- checkPropTypes.resetWarningCache = function() {
3425
- if (process.env.NODE_ENV !== 'production') {
3426
- loggedTypeFailures = {};
3427
- }
3428
- };
3429
-
3430
- checkPropTypes_1 = checkPropTypes;
3431
- return checkPropTypes_1;
3432
- }
3433
-
3434
- /**
3435
- * Copyright (c) 2013-present, Facebook, Inc.
3436
- *
3437
- * This source code is licensed under the MIT license found in the
3438
- * LICENSE file in the root directory of this source tree.
3439
- */
3440
-
3441
- var factoryWithTypeCheckers;
3442
- var hasRequiredFactoryWithTypeCheckers;
3443
-
3444
- function requireFactoryWithTypeCheckers () {
3445
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
3446
- hasRequiredFactoryWithTypeCheckers = 1;
3447
-
3448
- var ReactIs = requireReactIs();
3449
- var assign = requireObjectAssign();
3450
-
3451
- var ReactPropTypesSecret = requireReactPropTypesSecret();
3452
- var has = requireHas();
3453
- var checkPropTypes = requireCheckPropTypes();
3454
-
3455
- var printWarning = function() {};
3456
-
3457
- if (process.env.NODE_ENV !== 'production') {
3458
- printWarning = function(text) {
3459
- var message = 'Warning: ' + text;
3460
- if (typeof console !== 'undefined') {
3461
- console.error(message);
3462
- }
3463
- try {
3464
- // --- Welcome to debugging React ---
3465
- // This error was thrown as a convenience so that you can use this stack
3466
- // to find the callsite that caused this warning to fire.
3467
- throw new Error(message);
3468
- } catch (x) {}
3469
- };
3470
- }
3471
-
3472
- function emptyFunctionThatReturnsNull() {
3473
- return null;
3474
- }
3475
-
3476
- factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3477
- /* global Symbol */
3478
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
3479
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
3480
-
3481
- /**
3482
- * Returns the iterator method function contained on the iterable object.
3483
- *
3484
- * Be sure to invoke the function with the iterable as context:
3485
- *
3486
- * var iteratorFn = getIteratorFn(myIterable);
3487
- * if (iteratorFn) {
3488
- * var iterator = iteratorFn.call(myIterable);
3489
- * ...
3490
- * }
3491
- *
3492
- * @param {?object} maybeIterable
3493
- * @return {?function}
3494
- */
3495
- function getIteratorFn(maybeIterable) {
3496
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
3497
- if (typeof iteratorFn === 'function') {
3498
- return iteratorFn;
3499
- }
3500
- }
3501
-
3502
- /**
3503
- * Collection of methods that allow declaration and validation of props that are
3504
- * supplied to React components. Example usage:
3505
- *
3506
- * var Props = require('ReactPropTypes');
3507
- * var MyArticle = React.createClass({
3508
- * propTypes: {
3509
- * // An optional string prop named "description".
3510
- * description: Props.string,
3511
- *
3512
- * // A required enum prop named "category".
3513
- * category: Props.oneOf(['News','Photos']).isRequired,
3514
- *
3515
- * // A prop named "dialog" that requires an instance of Dialog.
3516
- * dialog: Props.instanceOf(Dialog).isRequired
3517
- * },
3518
- * render: function() { ... }
3519
- * });
3520
- *
3521
- * A more formal specification of how these methods are used:
3522
- *
3523
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
3524
- * decl := ReactPropTypes.{type}(.isRequired)?
3525
- *
3526
- * Each and every declaration produces a function with the same signature. This
3527
- * allows the creation of custom validation functions. For example:
3528
- *
3529
- * var MyLink = React.createClass({
3530
- * propTypes: {
3531
- * // An optional string or URI prop named "href".
3532
- * href: function(props, propName, componentName) {
3533
- * var propValue = props[propName];
3534
- * if (propValue != null && typeof propValue !== 'string' &&
3535
- * !(propValue instanceof URI)) {
3536
- * return new Error(
3537
- * 'Expected a string or an URI for ' + propName + ' in ' +
3538
- * componentName
3539
- * );
3540
- * }
3541
- * }
3542
- * },
3543
- * render: function() {...}
3544
- * });
3545
- *
3546
- * @internal
3547
- */
3548
-
3549
- var ANONYMOUS = '<<anonymous>>';
3550
-
3551
- // Important!
3552
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
3553
- var ReactPropTypes = {
3554
- array: createPrimitiveTypeChecker('array'),
3555
- bigint: createPrimitiveTypeChecker('bigint'),
3556
- bool: createPrimitiveTypeChecker('boolean'),
3557
- func: createPrimitiveTypeChecker('function'),
3558
- number: createPrimitiveTypeChecker('number'),
3559
- object: createPrimitiveTypeChecker('object'),
3560
- string: createPrimitiveTypeChecker('string'),
3561
- symbol: createPrimitiveTypeChecker('symbol'),
3562
-
3563
- any: createAnyTypeChecker(),
3564
- arrayOf: createArrayOfTypeChecker,
3565
- element: createElementTypeChecker(),
3566
- elementType: createElementTypeTypeChecker(),
3567
- instanceOf: createInstanceTypeChecker,
3568
- node: createNodeChecker(),
3569
- objectOf: createObjectOfTypeChecker,
3570
- oneOf: createEnumTypeChecker,
3571
- oneOfType: createUnionTypeChecker,
3572
- shape: createShapeTypeChecker,
3573
- exact: createStrictShapeTypeChecker,
3574
- };
3575
-
3576
- /**
3577
- * inlined Object.is polyfill to avoid requiring consumers ship their own
3578
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
3579
- */
3580
- /*eslint-disable no-self-compare*/
3581
- function is(x, y) {
3582
- // SameValue algorithm
3583
- if (x === y) {
3584
- // Steps 1-5, 7-10
3585
- // Steps 6.b-6.e: +0 != -0
3586
- return x !== 0 || 1 / x === 1 / y;
3587
- } else {
3588
- // Step 6.a: NaN == NaN
3589
- return x !== x && y !== y;
3590
- }
3591
- }
3592
- /*eslint-enable no-self-compare*/
3593
-
3594
- /**
3595
- * We use an Error-like object for backward compatibility as people may call
3596
- * PropTypes directly and inspect their output. However, we don't use real
3597
- * Errors anymore. We don't inspect their stack anyway, and creating them
3598
- * is prohibitively expensive if they are created too often, such as what
3599
- * happens in oneOfType() for any type before the one that matched.
3600
- */
3601
- function PropTypeError(message, data) {
3602
- this.message = message;
3603
- this.data = data && typeof data === 'object' ? data: {};
3604
- this.stack = '';
3605
- }
3606
- // Make `instanceof Error` still work for returned errors.
3607
- PropTypeError.prototype = Error.prototype;
3608
-
3609
- function createChainableTypeChecker(validate) {
3610
- if (process.env.NODE_ENV !== 'production') {
3611
- var manualPropTypeCallCache = {};
3612
- var manualPropTypeWarningCount = 0;
3613
- }
3614
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
3615
- componentName = componentName || ANONYMOUS;
3616
- propFullName = propFullName || propName;
3617
-
3618
- if (secret !== ReactPropTypesSecret) {
3619
- if (throwOnDirectAccess) {
3620
- // New behavior only for users of `prop-types` package
3621
- var err = new Error(
3622
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
3623
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
3624
- 'Read more at http://fb.me/use-check-prop-types'
3625
- );
3626
- err.name = 'Invariant Violation';
3627
- throw err;
3628
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
3629
- // Old behavior for people using React.PropTypes
3630
- var cacheKey = componentName + ':' + propName;
3631
- if (
3632
- !manualPropTypeCallCache[cacheKey] &&
3633
- // Avoid spamming the console because they are often not actionable except for lib authors
3634
- manualPropTypeWarningCount < 3
3635
- ) {
3636
- printWarning(
3637
- 'You are manually calling a React.PropTypes validation ' +
3638
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
3639
- 'and will throw in the standalone `prop-types` package. ' +
3640
- 'You may be seeing this warning due to a third-party PropTypes ' +
3641
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
3642
- );
3643
- manualPropTypeCallCache[cacheKey] = true;
3644
- manualPropTypeWarningCount++;
3645
- }
3646
- }
3647
- }
3648
- if (props[propName] == null) {
3649
- if (isRequired) {
3650
- if (props[propName] === null) {
3651
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
3652
- }
3653
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
3654
- }
3655
- return null;
3656
- } else {
3657
- return validate(props, propName, componentName, location, propFullName);
3658
- }
3659
- }
3660
-
3661
- var chainedCheckType = checkType.bind(null, false);
3662
- chainedCheckType.isRequired = checkType.bind(null, true);
3663
-
3664
- return chainedCheckType;
3665
- }
3666
-
3667
- function createPrimitiveTypeChecker(expectedType) {
3668
- function validate(props, propName, componentName, location, propFullName, secret) {
3669
- var propValue = props[propName];
3670
- var propType = getPropType(propValue);
3671
- if (propType !== expectedType) {
3672
- // `propValue` being instance of, say, date/regexp, pass the 'object'
3673
- // check, but we can offer a more precise error message here rather than
3674
- // 'of type `object`'.
3675
- var preciseType = getPreciseType(propValue);
3676
-
3677
- return new PropTypeError(
3678
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
3679
- {expectedType: expectedType}
3680
- );
3681
- }
3682
- return null;
3683
- }
3684
- return createChainableTypeChecker(validate);
3685
- }
3686
-
3687
- function createAnyTypeChecker() {
3688
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
3689
- }
3690
-
3691
- function createArrayOfTypeChecker(typeChecker) {
3692
- function validate(props, propName, componentName, location, propFullName) {
3693
- if (typeof typeChecker !== 'function') {
3694
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
3695
- }
3696
- var propValue = props[propName];
3697
- if (!Array.isArray(propValue)) {
3698
- var propType = getPropType(propValue);
3699
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
3700
- }
3701
- for (var i = 0; i < propValue.length; i++) {
3702
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
3703
- if (error instanceof Error) {
3704
- return error;
3705
- }
3706
- }
3707
- return null;
3708
- }
3709
- return createChainableTypeChecker(validate);
3710
- }
3711
-
3712
- function createElementTypeChecker() {
3713
- function validate(props, propName, componentName, location, propFullName) {
3714
- var propValue = props[propName];
3715
- if (!isValidElement(propValue)) {
3716
- var propType = getPropType(propValue);
3717
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
3718
- }
3719
- return null;
3720
- }
3721
- return createChainableTypeChecker(validate);
3722
- }
3723
-
3724
- function createElementTypeTypeChecker() {
3725
- function validate(props, propName, componentName, location, propFullName) {
3726
- var propValue = props[propName];
3727
- if (!ReactIs.isValidElementType(propValue)) {
3728
- var propType = getPropType(propValue);
3729
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
3730
- }
3731
- return null;
3732
- }
3733
- return createChainableTypeChecker(validate);
3734
- }
3735
-
3736
- function createInstanceTypeChecker(expectedClass) {
3737
- function validate(props, propName, componentName, location, propFullName) {
3738
- if (!(props[propName] instanceof expectedClass)) {
3739
- var expectedClassName = expectedClass.name || ANONYMOUS;
3740
- var actualClassName = getClassName(props[propName]);
3741
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
3742
- }
3743
- return null;
3744
- }
3745
- return createChainableTypeChecker(validate);
3746
- }
3747
-
3748
- function createEnumTypeChecker(expectedValues) {
3749
- if (!Array.isArray(expectedValues)) {
3750
- if (process.env.NODE_ENV !== 'production') {
3751
- if (arguments.length > 1) {
3752
- printWarning(
3753
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
3754
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
3755
- );
3756
- } else {
3757
- printWarning('Invalid argument supplied to oneOf, expected an array.');
3758
- }
3759
- }
3760
- return emptyFunctionThatReturnsNull;
3761
- }
3762
-
3763
- function validate(props, propName, componentName, location, propFullName) {
3764
- var propValue = props[propName];
3765
- for (var i = 0; i < expectedValues.length; i++) {
3766
- if (is(propValue, expectedValues[i])) {
3767
- return null;
3768
- }
3769
- }
3770
-
3771
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
3772
- var type = getPreciseType(value);
3773
- if (type === 'symbol') {
3774
- return String(value);
3775
- }
3776
- return value;
3777
- });
3778
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
3779
- }
3780
- return createChainableTypeChecker(validate);
3781
- }
3782
-
3783
- function createObjectOfTypeChecker(typeChecker) {
3784
- function validate(props, propName, componentName, location, propFullName) {
3785
- if (typeof typeChecker !== 'function') {
3786
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
3787
- }
3788
- var propValue = props[propName];
3789
- var propType = getPropType(propValue);
3790
- if (propType !== 'object') {
3791
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
3792
- }
3793
- for (var key in propValue) {
3794
- if (has(propValue, key)) {
3795
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3796
- if (error instanceof Error) {
3797
- return error;
3798
- }
3799
- }
3800
- }
3801
- return null;
3802
- }
3803
- return createChainableTypeChecker(validate);
3804
- }
3805
-
3806
- function createUnionTypeChecker(arrayOfTypeCheckers) {
3807
- if (!Array.isArray(arrayOfTypeCheckers)) {
3808
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
3809
- return emptyFunctionThatReturnsNull;
3810
- }
3811
-
3812
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3813
- var checker = arrayOfTypeCheckers[i];
3814
- if (typeof checker !== 'function') {
3815
- printWarning(
3816
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
3817
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
3818
- );
3819
- return emptyFunctionThatReturnsNull;
3820
- }
3821
- }
3822
-
3823
- function validate(props, propName, componentName, location, propFullName) {
3824
- var expectedTypes = [];
3825
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3826
- var checker = arrayOfTypeCheckers[i];
3827
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
3828
- if (checkerResult == null) {
3829
- return null;
3830
- }
3831
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
3832
- expectedTypes.push(checkerResult.data.expectedType);
3833
- }
3834
- }
3835
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
3836
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
3837
- }
3838
- return createChainableTypeChecker(validate);
3839
- }
3840
-
3841
- function createNodeChecker() {
3842
- function validate(props, propName, componentName, location, propFullName) {
3843
- if (!isNode(props[propName])) {
3844
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
3845
- }
3846
- return null;
3847
- }
3848
- return createChainableTypeChecker(validate);
3849
- }
3850
-
3851
- function invalidValidatorError(componentName, location, propFullName, key, type) {
3852
- return new PropTypeError(
3853
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
3854
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
3855
- );
3856
- }
3857
-
3858
- function createShapeTypeChecker(shapeTypes) {
3859
- function validate(props, propName, componentName, location, propFullName) {
3860
- var propValue = props[propName];
3861
- var propType = getPropType(propValue);
3862
- if (propType !== 'object') {
3863
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3864
- }
3865
- for (var key in shapeTypes) {
3866
- var checker = shapeTypes[key];
3867
- if (typeof checker !== 'function') {
3868
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3869
- }
3870
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3871
- if (error) {
3872
- return error;
3873
- }
3874
- }
3875
- return null;
3876
- }
3877
- return createChainableTypeChecker(validate);
3878
- }
3879
-
3880
- function createStrictShapeTypeChecker(shapeTypes) {
3881
- function validate(props, propName, componentName, location, propFullName) {
3882
- var propValue = props[propName];
3883
- var propType = getPropType(propValue);
3884
- if (propType !== 'object') {
3885
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3886
- }
3887
- // We need to check all keys in case some are required but missing from props.
3888
- var allKeys = assign({}, props[propName], shapeTypes);
3889
- for (var key in allKeys) {
3890
- var checker = shapeTypes[key];
3891
- if (has(shapeTypes, key) && typeof checker !== 'function') {
3892
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3893
- }
3894
- if (!checker) {
3895
- return new PropTypeError(
3896
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
3897
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
3898
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3899
- );
3900
- }
3901
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3902
- if (error) {
3903
- return error;
3904
- }
3905
- }
3906
- return null;
3907
- }
3908
-
3909
- return createChainableTypeChecker(validate);
3910
- }
3911
-
3912
- function isNode(propValue) {
3913
- switch (typeof propValue) {
3914
- case 'number':
3915
- case 'string':
3916
- case 'undefined':
3917
- return true;
3918
- case 'boolean':
3919
- return !propValue;
3920
- case 'object':
3921
- if (Array.isArray(propValue)) {
3922
- return propValue.every(isNode);
3923
- }
3924
- if (propValue === null || isValidElement(propValue)) {
3925
- return true;
3926
- }
3927
-
3928
- var iteratorFn = getIteratorFn(propValue);
3929
- if (iteratorFn) {
3930
- var iterator = iteratorFn.call(propValue);
3931
- var step;
3932
- if (iteratorFn !== propValue.entries) {
3933
- while (!(step = iterator.next()).done) {
3934
- if (!isNode(step.value)) {
3935
- return false;
3936
- }
3937
- }
3938
- } else {
3939
- // Iterator will provide entry [k,v] tuples rather than values.
3940
- while (!(step = iterator.next()).done) {
3941
- var entry = step.value;
3942
- if (entry) {
3943
- if (!isNode(entry[1])) {
3944
- return false;
3945
- }
3946
- }
3947
- }
3948
- }
3949
- } else {
3950
- return false;
3951
- }
3952
-
3953
- return true;
3954
- default:
3955
- return false;
3956
- }
3957
- }
3958
-
3959
- function isSymbol(propType, propValue) {
3960
- // Native Symbol.
3961
- if (propType === 'symbol') {
3962
- return true;
3963
- }
3964
-
3965
- // falsy value can't be a Symbol
3966
- if (!propValue) {
3967
- return false;
3968
- }
3969
-
3970
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
3971
- if (propValue['@@toStringTag'] === 'Symbol') {
3972
- return true;
3973
- }
3974
-
3975
- // Fallback for non-spec compliant Symbols which are polyfilled.
3976
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
3977
- return true;
3978
- }
3979
-
3980
- return false;
3981
- }
3982
-
3983
- // Equivalent of `typeof` but with special handling for array and regexp.
3984
- function getPropType(propValue) {
3985
- var propType = typeof propValue;
3986
- if (Array.isArray(propValue)) {
3987
- return 'array';
3988
- }
3989
- if (propValue instanceof RegExp) {
3990
- // Old webkits (at least until Android 4.0) return 'function' rather than
3991
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
3992
- // passes PropTypes.object.
3993
- return 'object';
3994
- }
3995
- if (isSymbol(propType, propValue)) {
3996
- return 'symbol';
3997
- }
3998
- return propType;
3999
- }
4000
-
4001
- // This handles more types than `getPropType`. Only used for error messages.
4002
- // See `createPrimitiveTypeChecker`.
4003
- function getPreciseType(propValue) {
4004
- if (typeof propValue === 'undefined' || propValue === null) {
4005
- return '' + propValue;
4006
- }
4007
- var propType = getPropType(propValue);
4008
- if (propType === 'object') {
4009
- if (propValue instanceof Date) {
4010
- return 'date';
4011
- } else if (propValue instanceof RegExp) {
4012
- return 'regexp';
4013
- }
4014
- }
4015
- return propType;
4016
- }
4017
-
4018
- // Returns a string that is postfixed to a warning about an invalid type.
4019
- // For example, "undefined" or "of type array"
4020
- function getPostfixForTypeWarning(value) {
4021
- var type = getPreciseType(value);
4022
- switch (type) {
4023
- case 'array':
4024
- case 'object':
4025
- return 'an ' + type;
4026
- case 'boolean':
4027
- case 'date':
4028
- case 'regexp':
4029
- return 'a ' + type;
4030
- default:
4031
- return type;
4032
- }
4033
- }
4034
-
4035
- // Returns class name of the object, if any.
4036
- function getClassName(propValue) {
4037
- if (!propValue.constructor || !propValue.constructor.name) {
4038
- return ANONYMOUS;
4039
- }
4040
- return propValue.constructor.name;
4041
- }
4042
-
4043
- ReactPropTypes.checkPropTypes = checkPropTypes;
4044
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
4045
- ReactPropTypes.PropTypes = ReactPropTypes;
4046
-
4047
- return ReactPropTypes;
4048
- };
4049
- return factoryWithTypeCheckers;
4050
- }
4051
-
4052
- /**
4053
- * Copyright (c) 2013-present, Facebook, Inc.
4054
- *
4055
- * This source code is licensed under the MIT license found in the
4056
- * LICENSE file in the root directory of this source tree.
4057
- */
4058
-
4059
- var factoryWithThrowingShims;
4060
- var hasRequiredFactoryWithThrowingShims;
4061
-
4062
- function requireFactoryWithThrowingShims () {
4063
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
4064
- hasRequiredFactoryWithThrowingShims = 1;
4065
-
4066
- var ReactPropTypesSecret = requireReactPropTypesSecret();
4067
-
4068
- function emptyFunction() {}
4069
- function emptyFunctionWithReset() {}
4070
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
4071
-
4072
- factoryWithThrowingShims = function() {
4073
- function shim(props, propName, componentName, location, propFullName, secret) {
4074
- if (secret === ReactPropTypesSecret) {
4075
- // It is still safe when called from React.
4076
- return;
4077
- }
4078
- var err = new Error(
4079
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
4080
- 'Use PropTypes.checkPropTypes() to call them. ' +
4081
- 'Read more at http://fb.me/use-check-prop-types'
4082
- );
4083
- err.name = 'Invariant Violation';
4084
- throw err;
4085
- } shim.isRequired = shim;
4086
- function getShim() {
4087
- return shim;
4088
- } // Important!
4089
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
4090
- var ReactPropTypes = {
4091
- array: shim,
4092
- bigint: shim,
4093
- bool: shim,
4094
- func: shim,
4095
- number: shim,
4096
- object: shim,
4097
- string: shim,
4098
- symbol: shim,
4099
-
4100
- any: shim,
4101
- arrayOf: getShim,
4102
- element: shim,
4103
- elementType: shim,
4104
- instanceOf: getShim,
4105
- node: shim,
4106
- objectOf: getShim,
4107
- oneOf: getShim,
4108
- oneOfType: getShim,
4109
- shape: getShim,
4110
- exact: getShim,
4111
-
4112
- checkPropTypes: emptyFunctionWithReset,
4113
- resetWarningCache: emptyFunction
4114
- };
4115
-
4116
- ReactPropTypes.PropTypes = ReactPropTypes;
4117
-
4118
- return ReactPropTypes;
4119
- };
4120
- return factoryWithThrowingShims;
4121
- }
4122
-
4123
- /**
4124
- * Copyright (c) 2013-present, Facebook, Inc.
4125
- *
4126
- * This source code is licensed under the MIT license found in the
4127
- * LICENSE file in the root directory of this source tree.
4128
- */
4129
-
4130
- if (process.env.NODE_ENV !== 'production') {
4131
- var ReactIs = requireReactIs();
4132
-
4133
- // By explicitly using `prop-types` you are opting into new development behavior.
4134
- // http://fb.me/prop-types-in-prod
4135
- var throwOnDirectAccess = true;
4136
- propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
4137
- } else {
4138
- // By explicitly using `prop-types` you are opting into new production behavior.
4139
- // http://fb.me/prop-types-in-prod
4140
- propTypes.exports = requireFactoryWithThrowingShims()();
4141
- }
4142
-
4143
- var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
4144
- var EmailPreview = withT(function (_ref) {
4145
- var t = _ref.t,
4146
- _ref$to = _ref.to,
4147
- to = _ref$to === void 0 ? [] : _ref$to,
4148
- from = _ref.from,
4149
- subject = _ref.subject,
4150
- body = _ref.body,
4151
- productName = _ref.productName,
4152
- actionButtonText = _ref.actionButtonText,
4153
- logo = _ref.logo,
4154
- _ref$className = _ref.className,
4155
- className = _ref$className === void 0 ? "" : _ref$className;
4156
- return /*#__PURE__*/React.createElement("div", {
4157
- "data-cy": "email-preview-card",
4158
- "data-testid": "email-preview",
4159
- className: classnames("neeto-ui-border-gray-300 neeto-ui-shadow-m neeto-ui-bg-white flex flex-1 flex-col border", _defineProperty({}, className, className))
4160
- }, /*#__PURE__*/React.createElement("div", {
4161
- className: "neeto-ui-border-gray-300 space-y-3 divide-y divide-gray-200 border-b p-6"
4162
- }, /*#__PURE__*/React.createElement("div", {
4163
- className: "flex gap-2",
4164
- "data-cy": "email-send-to-preview",
4165
- "data-testid": "email-to-block"
4166
- }, /*#__PURE__*/React.createElement(Typography, {
4167
- className: "neeto-ui-text-gray-500",
4168
- lineHeight: "normal",
4169
- style: "body2"
4170
- }, t("neetoMolecules.emailPreview.to"), ":"), isPresent(to) && isNotEmpty(to) ? /*#__PURE__*/React.createElement(Typography, {
4171
- className: "neeto-ui-text-gray-800 min-w-0 flex-grow break-words",
4172
- lineHeight: "normal",
4173
- style: "body2"
4174
- }, to.join(", ")) : /*#__PURE__*/React.createElement("div", {
4175
- className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full mt-2 h-2 w-40"
4176
- })), from && /*#__PURE__*/React.createElement("div", {
4177
- className: "flex items-center gap-2 pt-3"
4178
- }, /*#__PURE__*/React.createElement(Typography, {
4179
- className: "neeto-ui-text-gray-500",
4180
- lineHeight: "normal",
4181
- style: "body2"
4182
- }, t("neetoMolecules.emailPreview.from"), ":"), /*#__PURE__*/React.createElement(Typography, {
4183
- className: "neeto-ui-text-gray-800 min-w-0 flex-grow break-words",
4184
- "data-cy": "email-send-from-preview",
4185
- lineHeight: "normal",
4186
- style: "body2"
4187
- }, from)), /*#__PURE__*/React.createElement("div", {
4188
- className: "flex items-center gap-2 pt-3"
4189
- }, /*#__PURE__*/React.createElement(Typography, {
4190
- className: "neeto-ui-text-gray-500",
4191
- lineHeight: "normal",
4192
- style: "body2"
4193
- }, t("neetoMolecules.emailPreview.subject"), ":"), /*#__PURE__*/React.createElement(Typography, {
4194
- className: "neeto-ui-text-gray-800 min-w-0 flex-grow break-words",
4195
- "data-cy": "email-subject-preview",
4196
- lineHeight: "normal",
4197
- style: "body2"
4198
- }, subject || /*#__PURE__*/React.createElement("span", {
4199
- className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-40"
4200
- })))), /*#__PURE__*/React.createElement("div", {
4201
- className: "neeto-ui-text-gray-800 flex flex-1 flex-col justify-between space-y-6 p-6 pr-10 text-base leading-relaxed",
4202
- "data-cy": "email-body-preview-container"
4203
- }, body ? /*#__PURE__*/React.createElement(MemoizedEditorContent, {
4204
- content: body
4205
- }) : /*#__PURE__*/React.createElement("div", {
4206
- className: "space-y-4"
4207
- }, /*#__PURE__*/React.createElement("div", {
4208
- className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-80"
4209
- }), /*#__PURE__*/React.createElement("div", {
4210
- className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-72"
4211
- }), /*#__PURE__*/React.createElement("div", {
4212
- className: "neeto-ui-bg-gray-300 neeto-ui-rounded-full h-2 w-80"
4213
- })), actionButtonText && /*#__PURE__*/React.createElement("div", {
4214
- className: "mt-6 flex w-full items-center justify-center"
4215
- }, /*#__PURE__*/React.createElement(Button, {
4216
- className: "pointer-events-none",
4217
- label: actionButtonText
4218
- })), logo && /*#__PURE__*/React.createElement("img", {
4219
- alt: t("neetoMolecules.emailPreview.logoAltText"),
4220
- className: "h-20 w-36 object-cover",
4221
- "data-cy": "company-logo-preview",
4222
- src: logo
4223
- })), productName && /*#__PURE__*/React.createElement("div", {
4224
- className: "neeto-ui-bg-gray-100 mt-auto p-2",
4225
- "data-testid": "product-name-block"
4226
- }, /*#__PURE__*/React.createElement(Typography, {
4227
- className: "neeto-ui-text-gray-600 text-center leading-6",
4228
- style: "body3"
4229
- }, t("neetoMolecules.emailPreview.poweredBy"), /*#__PURE__*/React.createElement("span", {
4230
- className: "neeto-ui-text-gray-800 font-medium"
4231
- }, productName))));
4232
- });
4233
- EmailPreview.propTypes = {
4234
- /**
4235
- * The value of the send-to field.
4236
- */
4237
- to: propTypes.exports.arrayOf(propTypes.exports.string),
4238
- /**
4239
- * The value of the send-from field.
4240
- */
4241
- from: propTypes.exports.string,
4242
- /**
4243
- * The subject of the email.
4244
- */
4245
- subject: propTypes.exports.string,
4246
- /**
4247
- * The body of the email.
4248
- */
4249
- body: propTypes.exports.string,
4250
- /**
4251
- * The name of the neeto product to be previewed.
4252
- */
4253
- productName: propTypes.exports.string,
4254
- /**
4255
- * The text to be shown in the action button.
4256
- */
4257
- actionButtonText: propTypes.exports.string,
4258
- /**
4259
- * Source link for the company logo.
4260
- */
4261
- logo: propTypes.exports.string
4262
- };
4263
-
4264
- export { EmailForm, EmailFormProvider, EmailPreview };
4265
- //# sourceMappingURL=EmailForm.js.map