@bigbinary/neeto-molecules 1.1.10 → 1.1.12

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