@bigbinary/neeto-commons-frontend 3.0.5 → 3.0.7

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 (385) hide show
  1. package/{constants.cjs.js → cjs/constants/index.js} +11 -10
  2. package/cjs/constants/index.js.map +1 -0
  3. package/cjs/cypress-utils/commands.js +276 -0
  4. package/cjs/cypress-utils/commands.js.map +1 -0
  5. package/cjs/cypress-utils/constants/index.js +14 -0
  6. package/cjs/cypress-utils/constants/index.js.map +1 -0
  7. package/cjs/cypress-utils/constants/routes.js +40 -0
  8. package/cjs/cypress-utils/constants/routes.js.map +1 -0
  9. package/cjs/cypress-utils/constants/selectors/common.js +103 -0
  10. package/cjs/cypress-utils/constants/selectors/common.js.map +1 -0
  11. package/cjs/cypress-utils/constants/selectors/editor.js +29 -0
  12. package/cjs/cypress-utils/constants/selectors/editor.js.map +1 -0
  13. package/cjs/cypress-utils/constants/selectors/ipRestriction.js +19 -0
  14. package/cjs/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
  15. package/cjs/cypress-utils/constants/selectors/login.js +21 -0
  16. package/cjs/cypress-utils/constants/selectors/login.js.map +1 -0
  17. package/cjs/cypress-utils/constants/selectors/member.js +65 -0
  18. package/cjs/cypress-utils/constants/selectors/member.js.map +1 -0
  19. package/cjs/cypress-utils/constants/selectors/navigation.js +28 -0
  20. package/cjs/cypress-utils/constants/selectors/navigation.js.map +1 -0
  21. package/cjs/cypress-utils/constants/selectors/roles.js +24 -0
  22. package/cjs/cypress-utils/constants/selectors/roles.js.map +1 -0
  23. package/cjs/cypress-utils/constants/selectors/signUp.js +23 -0
  24. package/cjs/cypress-utils/constants/selectors/signUp.js.map +1 -0
  25. package/cjs/cypress-utils/constants/selectors/tags.js +31 -0
  26. package/cjs/cypress-utils/constants/selectors/tags.js.map +1 -0
  27. package/cjs/cypress-utils/constants/texts/common.js +40 -0
  28. package/cjs/cypress-utils/constants/texts/common.js.map +1 -0
  29. package/cjs/cypress-utils/constants/texts/member.js +68 -0
  30. package/cjs/cypress-utils/constants/texts/member.js.map +1 -0
  31. package/cjs/cypress-utils/constants/texts/navigation.js +24 -0
  32. package/cjs/cypress-utils/constants/texts/navigation.js.map +1 -0
  33. package/cjs/cypress-utils/constants/texts/roles.js +25 -0
  34. package/cjs/cypress-utils/constants/texts/roles.js.map +1 -0
  35. package/cjs/cypress-utils/constants/texts/signUp.js +14 -0
  36. package/cjs/cypress-utils/constants/texts/signUp.js.map +1 -0
  37. package/cjs/cypress-utils/constants/texts/tags.js +28 -0
  38. package/cjs/cypress-utils/constants/texts/tags.js.map +1 -0
  39. package/cjs/cypress-utils/fixtures/fake.js +177 -0
  40. package/cjs/cypress-utils/fixtures/fake.js.map +1 -0
  41. package/cjs/cypress-utils/index.js +226 -0
  42. package/cjs/cypress-utils/index.js.map +1 -0
  43. package/cjs/cypress-utils/utils/authentication.js +45 -0
  44. package/cjs/cypress-utils/utils/authentication.js.map +1 -0
  45. package/cjs/cypress-utils/utils/common.js +92 -0
  46. package/cjs/cypress-utils/utils/common.js.map +1 -0
  47. package/cjs/cypress-utils/utils/date.js +28 -0
  48. package/cjs/cypress-utils/utils/date.js.map +1 -0
  49. package/cjs/cypress-utils/utils/email.js +165 -0
  50. package/cjs/cypress-utils/utils/email.js.map +1 -0
  51. package/cjs/cypress-utils/utils/member.js +352 -0
  52. package/cjs/cypress-utils/utils/member.js.map +1 -0
  53. package/cjs/cypress-utils/utils/navigation.js +208 -0
  54. package/cjs/cypress-utils/utils/navigation.js.map +1 -0
  55. package/cjs/cypress-utils/utils/organization.js +109 -0
  56. package/cjs/cypress-utils/utils/organization.js.map +1 -0
  57. package/cjs/cypress-utils/utils/validation.js +17 -0
  58. package/cjs/cypress-utils/utils/validation.js.map +1 -0
  59. package/cjs/initializers/axios/index.js +199 -0
  60. package/cjs/initializers/axios/index.js.map +1 -0
  61. package/cjs/initializers/axios/paramsSerializer.js +27 -0
  62. package/cjs/initializers/axios/paramsSerializer.js.map +1 -0
  63. package/cjs/initializers/constants.js +17 -0
  64. package/cjs/initializers/constants.js.map +1 -0
  65. package/cjs/initializers/globalProps.js +15 -0
  66. package/cjs/initializers/globalProps.js.map +1 -0
  67. package/cjs/initializers/i18n.js +68 -0
  68. package/cjs/initializers/i18n.js.map +1 -0
  69. package/cjs/initializers/index.js +51 -0
  70. package/cjs/initializers/index.js.map +1 -0
  71. package/cjs/initializers/logger.js +17 -0
  72. package/cjs/initializers/logger.js.map +1 -0
  73. package/cjs/initializers/reactDevTools.js +26 -0
  74. package/cjs/initializers/reactDevTools.js.map +1 -0
  75. package/cjs/initializers/utils/customFormatters.js +43 -0
  76. package/cjs/initializers/utils/customFormatters.js.map +1 -0
  77. package/cjs/initializers/utils/customPostProcessors.js +21 -0
  78. package/cjs/initializers/utils/customPostProcessors.js.map +1 -0
  79. package/cjs/initializers/utils.js +37 -0
  80. package/cjs/initializers/utils.js.map +1 -0
  81. package/cjs/react-utils/BrowserPushNotifications/devices.js +26 -0
  82. package/cjs/react-utils/BrowserPushNotifications/devices.js.map +1 -0
  83. package/cjs/react-utils/BrowserPushNotifications/index.js +19 -0
  84. package/cjs/react-utils/BrowserPushNotifications/index.js.map +1 -0
  85. package/cjs/react-utils/BrowserPushNotifications/pushHelper.js +116 -0
  86. package/cjs/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
  87. package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js +146 -0
  88. package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
  89. package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +153 -0
  90. package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
  91. package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js +9 -0
  92. package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
  93. package/cjs/react-utils/HoneybadgerErrorBoundary/index.js +59 -0
  94. package/cjs/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
  95. package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js +17 -0
  96. package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
  97. package/cjs/react-utils/PrivateRoute.js +80 -0
  98. package/cjs/react-utils/PrivateRoute.js.map +1 -0
  99. package/cjs/react-utils/constants/constants.js +11 -0
  100. package/cjs/react-utils/constants/constants.js.map +1 -0
  101. package/cjs/react-utils/constants/index.js +28 -0
  102. package/cjs/react-utils/constants/index.js.map +1 -0
  103. package/cjs/react-utils/constants/query.js +11 -0
  104. package/cjs/react-utils/constants/query.js.map +1 -0
  105. package/cjs/react-utils/index.js +242 -0
  106. package/cjs/react-utils/index.js.map +1 -0
  107. package/cjs/react-utils/metaClick.js +16 -0
  108. package/cjs/react-utils/metaClick.js.map +1 -0
  109. package/cjs/react-utils/useDebounce.js +28 -0
  110. package/cjs/react-utils/useDebounce.js.map +1 -0
  111. package/cjs/react-utils/useDisplayErrorPage.js +23 -0
  112. package/cjs/react-utils/useDisplayErrorPage.js.map +1 -0
  113. package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js +17 -0
  114. package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
  115. package/cjs/react-utils/useFetchNeetoApps/index.js +14 -0
  116. package/cjs/react-utils/useFetchNeetoApps/index.js.map +1 -0
  117. package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +27 -0
  118. package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
  119. package/cjs/react-utils/useFieldSubmit.js +33 -0
  120. package/cjs/react-utils/useFieldSubmit.js.map +1 -0
  121. package/cjs/react-utils/useFuncDebounce.js +27 -0
  122. package/cjs/react-utils/useFuncDebounce.js.map +1 -0
  123. package/cjs/react-utils/useHotKeys/constants.js +36 -0
  124. package/cjs/react-utils/useHotKeys/constants.js.map +1 -0
  125. package/cjs/react-utils/useHotKeys/index.js +14 -0
  126. package/cjs/react-utils/useHotKeys/index.js.map +1 -0
  127. package/cjs/react-utils/useHotKeys/useHotKeys.js +65 -0
  128. package/cjs/react-utils/useHotKeys/useHotKeys.js.map +1 -0
  129. package/cjs/react-utils/useHotKeys/utils.js +37 -0
  130. package/cjs/react-utils/useHotKeys/utils.js.map +1 -0
  131. package/cjs/react-utils/useIsElementVisibleInDom/index.js +14 -0
  132. package/cjs/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
  133. package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js +23 -0
  134. package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
  135. package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +34 -0
  136. package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
  137. package/cjs/react-utils/useKeyboardShortcutsPaneState.js +36 -0
  138. package/cjs/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
  139. package/cjs/react-utils/useLocalStorage.js +39 -0
  140. package/cjs/react-utils/useLocalStorage.js.map +1 -0
  141. package/cjs/react-utils/useMutationWithInvalidation.js +33 -0
  142. package/cjs/react-utils/useMutationWithInvalidation.js.map +1 -0
  143. package/cjs/react-utils/useOnClickOutside.js +32 -0
  144. package/cjs/react-utils/useOnClickOutside.js.map +1 -0
  145. package/cjs/react-utils/usePersistedQuery.js +59 -0
  146. package/cjs/react-utils/usePersistedQuery.js.map +1 -0
  147. package/cjs/react-utils/usePrevious.js +17 -0
  148. package/cjs/react-utils/usePrevious.js.map +1 -0
  149. package/cjs/react-utils/useQueryParams.js +15 -0
  150. package/cjs/react-utils/useQueryParams.js.map +1 -0
  151. package/cjs/react-utils/useRegisterNavigationCheckpoint.js +43 -0
  152. package/cjs/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
  153. package/cjs/react-utils/useStateWithDependency.js +23 -0
  154. package/cjs/react-utils/useStateWithDependency.js.map +1 -0
  155. package/cjs/react-utils/useTimer.js +51 -0
  156. package/cjs/react-utils/useTimer.js.map +1 -0
  157. package/cjs/react-utils/useUpdateEffect.js +21 -0
  158. package/cjs/react-utils/useUpdateEffect.js.map +1 -0
  159. package/cjs/react-utils/withImmutableActions.js +29 -0
  160. package/cjs/react-utils/withImmutableActions.js.map +1 -0
  161. package/cjs/react-utils/withT.js +14 -0
  162. package/cjs/react-utils/withT.js.map +1 -0
  163. package/cjs/react-utils/withTitle.js +44 -0
  164. package/cjs/react-utils/withTitle.js.map +1 -0
  165. package/cjs/utils/axios.js +17 -0
  166. package/cjs/utils/axios.js.map +1 -0
  167. package/cjs/utils/createSubscription.js +22 -0
  168. package/cjs/utils/createSubscription.js.map +1 -0
  169. package/cjs/utils/currencyFormat.js +50 -0
  170. package/cjs/utils/currencyFormat.js.map +1 -0
  171. package/cjs/utils/datetime.js +69 -0
  172. package/cjs/utils/datetime.js.map +1 -0
  173. package/cjs/utils/general.js +193 -0
  174. package/cjs/utils/general.js.map +1 -0
  175. package/cjs/utils/index.js +72 -0
  176. package/cjs/utils/index.js.map +1 -0
  177. package/cjs/utils/permissions.js +25 -0
  178. package/cjs/utils/permissions.js.map +1 -0
  179. package/configs/scripts/getPkgTranslations.js +1 -1
  180. package/configs/scripts/jsdoc-builder/constants.mjs +1 -1
  181. package/configs/scripts/jsdoc-builder/index.mjs +1 -1
  182. package/configs/webpack/rules.js +2 -1
  183. package/constants/index.js +13 -0
  184. package/constants/index.js.map +1 -0
  185. package/cypress-utils/commands.js +268 -0
  186. package/cypress-utils/commands.js.map +1 -0
  187. package/cypress-utils/constants/index.js +7 -0
  188. package/cypress-utils/constants/index.js.map +1 -0
  189. package/cypress-utils/constants/routes.js +33 -0
  190. package/cypress-utils/constants/routes.js.map +1 -0
  191. package/cypress-utils/constants/selectors/common.js +94 -0
  192. package/cypress-utils/constants/selectors/common.js.map +1 -0
  193. package/cypress-utils/constants/selectors/editor.js +22 -0
  194. package/cypress-utils/constants/selectors/editor.js.map +1 -0
  195. package/cypress-utils/constants/selectors/ipRestriction.js +12 -0
  196. package/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
  197. package/cypress-utils/constants/selectors/login.js +14 -0
  198. package/cypress-utils/constants/selectors/login.js.map +1 -0
  199. package/cypress-utils/constants/selectors/member.js +56 -0
  200. package/cypress-utils/constants/selectors/member.js.map +1 -0
  201. package/cypress-utils/constants/selectors/navigation.js +20 -0
  202. package/cypress-utils/constants/selectors/navigation.js.map +1 -0
  203. package/cypress-utils/constants/selectors/roles.js +17 -0
  204. package/cypress-utils/constants/selectors/roles.js.map +1 -0
  205. package/cypress-utils/constants/selectors/signUp.js +16 -0
  206. package/cypress-utils/constants/selectors/signUp.js.map +1 -0
  207. package/cypress-utils/constants/selectors/tags.js +23 -0
  208. package/cypress-utils/constants/selectors/tags.js.map +1 -0
  209. package/cypress-utils/constants/texts/common.js +33 -0
  210. package/cypress-utils/constants/texts/common.js.map +1 -0
  211. package/cypress-utils/constants/texts/member.js +59 -0
  212. package/cypress-utils/constants/texts/member.js.map +1 -0
  213. package/cypress-utils/constants/texts/navigation.js +16 -0
  214. package/cypress-utils/constants/texts/navigation.js.map +1 -0
  215. package/cypress-utils/constants/texts/roles.js +18 -0
  216. package/cypress-utils/constants/texts/roles.js.map +1 -0
  217. package/cypress-utils/constants/texts/signUp.js +7 -0
  218. package/cypress-utils/constants/texts/signUp.js.map +1 -0
  219. package/cypress-utils/constants/texts/tags.js +21 -0
  220. package/cypress-utils/constants/texts/tags.js.map +1 -0
  221. package/cypress-utils/fixtures/fake.js +171 -0
  222. package/cypress-utils/fixtures/fake.js.map +1 -0
  223. package/cypress-utils/index.js +21 -0
  224. package/cypress-utils/index.js.map +1 -0
  225. package/cypress-utils/utils/authentication.js +38 -0
  226. package/cypress-utils/utils/authentication.js.map +1 -0
  227. package/cypress-utils/utils/common.js +75 -0
  228. package/cypress-utils/utils/common.js.map +1 -0
  229. package/cypress-utils/utils/date.js +20 -0
  230. package/cypress-utils/utils/date.js.map +1 -0
  231. package/cypress-utils/utils/email.js +156 -0
  232. package/cypress-utils/utils/email.js.map +1 -0
  233. package/cypress-utils/utils/member.js +344 -0
  234. package/cypress-utils/utils/member.js.map +1 -0
  235. package/cypress-utils/utils/navigation.js +200 -0
  236. package/cypress-utils/utils/navigation.js.map +1 -0
  237. package/cypress-utils/utils/organization.js +102 -0
  238. package/cypress-utils/utils/organization.js.map +1 -0
  239. package/cypress-utils/utils/validation.js +10 -0
  240. package/cypress-utils/utils/validation.js.map +1 -0
  241. package/initializers/axios/index.js +192 -0
  242. package/initializers/axios/index.js.map +1 -0
  243. package/initializers/axios/paramsSerializer.js +18 -0
  244. package/initializers/axios/paramsSerializer.js.map +1 -0
  245. package/initializers/constants.js +8 -0
  246. package/initializers/constants.js.map +1 -0
  247. package/initializers/globalProps.js +8 -0
  248. package/initializers/globalProps.js.map +1 -0
  249. package/initializers/i18n.js +61 -0
  250. package/initializers/i18n.js.map +1 -0
  251. package/initializers/index.js +28 -0
  252. package/initializers/index.js.map +1 -0
  253. package/initializers/logger.js +10 -0
  254. package/initializers/logger.js.map +1 -0
  255. package/initializers/reactDevTools.js +19 -0
  256. package/initializers/reactDevTools.js.map +1 -0
  257. package/initializers/utils/customFormatters.js +34 -0
  258. package/initializers/utils/customFormatters.js.map +1 -0
  259. package/initializers/utils/customPostProcessors.js +14 -0
  260. package/initializers/utils/customPostProcessors.js.map +1 -0
  261. package/initializers/utils.js +29 -0
  262. package/initializers/utils.js.map +1 -0
  263. package/package.json +51 -158
  264. package/pure.d.ts +384 -0
  265. package/react-utils/BrowserPushNotifications/devices.js +18 -0
  266. package/react-utils/BrowserPushNotifications/devices.js.map +1 -0
  267. package/react-utils/BrowserPushNotifications/index.js +1 -0
  268. package/react-utils/BrowserPushNotifications/index.js.map +1 -0
  269. package/react-utils/BrowserPushNotifications/pushHelper.js +107 -0
  270. package/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
  271. package/react-utils/BrowserPushNotifications/registerServiceWorker.js +137 -0
  272. package/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
  273. package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +144 -0
  274. package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
  275. package/react-utils/HoneybadgerErrorBoundary/constants.js +1 -0
  276. package/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
  277. package/react-utils/HoneybadgerErrorBoundary/index.js +52 -0
  278. package/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
  279. package/react-utils/HoneybadgerErrorBoundary/utils.js +9 -0
  280. package/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
  281. package/react-utils/PrivateRoute.js +72 -0
  282. package/react-utils/PrivateRoute.js.map +1 -0
  283. package/react-utils/constants/constants.js +3 -0
  284. package/react-utils/constants/constants.js.map +1 -0
  285. package/react-utils/constants/index.js +3 -0
  286. package/react-utils/constants/index.js.map +1 -0
  287. package/react-utils/constants/query.js +4 -0
  288. package/react-utils/constants/query.js.map +1 -0
  289. package/react-utils/index.js +33 -0
  290. package/react-utils/index.js.map +1 -0
  291. package/react-utils/metaClick.js +8 -0
  292. package/react-utils/metaClick.js.map +1 -0
  293. package/react-utils/useDebounce.js +20 -0
  294. package/react-utils/useDebounce.js.map +1 -0
  295. package/react-utils/useDisplayErrorPage.js +15 -0
  296. package/react-utils/useDisplayErrorPage.js.map +1 -0
  297. package/react-utils/useFetchNeetoApps/apis/neeto_apps.js +9 -0
  298. package/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
  299. package/react-utils/useFetchNeetoApps/index.js +1 -0
  300. package/react-utils/useFetchNeetoApps/index.js.map +1 -0
  301. package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +19 -0
  302. package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
  303. package/react-utils/useFieldSubmit.js +26 -0
  304. package/react-utils/useFieldSubmit.js.map +1 -0
  305. package/react-utils/useFuncDebounce.js +20 -0
  306. package/react-utils/useFuncDebounce.js.map +1 -0
  307. package/react-utils/useHotKeys/constants.js +25 -0
  308. package/react-utils/useHotKeys/constants.js.map +1 -0
  309. package/react-utils/useHotKeys/index.js +1 -0
  310. package/react-utils/useHotKeys/index.js.map +1 -0
  311. package/react-utils/useHotKeys/useHotKeys.js +57 -0
  312. package/react-utils/useHotKeys/useHotKeys.js.map +1 -0
  313. package/react-utils/useHotKeys/utils.js +29 -0
  314. package/react-utils/useHotKeys/utils.js.map +1 -0
  315. package/react-utils/useIsElementVisibleInDom/index.js +1 -0
  316. package/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
  317. package/react-utils/useIsElementVisibleInDom/useForceUpdate.js +15 -0
  318. package/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
  319. package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +26 -0
  320. package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
  321. package/react-utils/useKeyboardShortcutsPaneState.js +29 -0
  322. package/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
  323. package/react-utils/useLocalStorage.js +31 -0
  324. package/react-utils/useLocalStorage.js.map +1 -0
  325. package/react-utils/useMutationWithInvalidation.js +25 -0
  326. package/react-utils/useMutationWithInvalidation.js.map +1 -0
  327. package/react-utils/useOnClickOutside.js +25 -0
  328. package/react-utils/useOnClickOutside.js.map +1 -0
  329. package/react-utils/usePersistedQuery.js +51 -0
  330. package/react-utils/usePersistedQuery.js.map +1 -0
  331. package/react-utils/usePrevious.js +10 -0
  332. package/react-utils/usePrevious.js.map +1 -0
  333. package/react-utils/useQueryParams.js +8 -0
  334. package/react-utils/useQueryParams.js.map +1 -0
  335. package/react-utils/useRegisterNavigationCheckpoint.js +35 -0
  336. package/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
  337. package/react-utils/useStateWithDependency.js +15 -0
  338. package/react-utils/useStateWithDependency.js.map +1 -0
  339. package/react-utils/useTimer.js +43 -0
  340. package/react-utils/useTimer.js.map +1 -0
  341. package/react-utils/useUpdateEffect.js +14 -0
  342. package/react-utils/useUpdateEffect.js.map +1 -0
  343. package/react-utils/withImmutableActions.js +22 -0
  344. package/react-utils/withImmutableActions.js.map +1 -0
  345. package/react-utils/withT.js +7 -0
  346. package/react-utils/withT.js.map +1 -0
  347. package/react-utils/withTitle.js +36 -0
  348. package/react-utils/withTitle.js.map +1 -0
  349. package/react-utils.d.ts +14 -2
  350. package/utils/axios.js +10 -0
  351. package/utils/axios.js.map +1 -0
  352. package/utils/createSubscription.js +15 -0
  353. package/utils/createSubscription.js.map +1 -0
  354. package/utils/currencyFormat.js +42 -0
  355. package/utils/currencyFormat.js.map +1 -0
  356. package/utils/datetime.js +60 -0
  357. package/utils/datetime.js.map +1 -0
  358. package/utils/general.js +172 -0
  359. package/utils/general.js.map +1 -0
  360. package/utils/index.js +7 -0
  361. package/utils/index.js.map +1 -0
  362. package/utils/permissions.js +16 -0
  363. package/utils/permissions.js.map +1 -0
  364. package/utils.d.ts +18 -2
  365. package/README.md +0 -173
  366. package/constants.cjs.js.map +0 -1
  367. package/constants.js +0 -15
  368. package/constants.js.map +0 -1
  369. package/cypress-utils.cjs.js +0 -1819
  370. package/cypress-utils.cjs.js.map +0 -1
  371. package/cypress-utils.js +0 -1773
  372. package/cypress-utils.js.map +0 -1
  373. package/initializers.cjs.js +0 -2648
  374. package/initializers.cjs.js.map +0 -1
  375. package/initializers.js +0 -2634
  376. package/initializers.js.map +0 -1
  377. package/react-utils.cjs.js +0 -4915
  378. package/react-utils.cjs.js.map +0 -1
  379. package/react-utils.js +0 -4860
  380. package/react-utils.js.map +0 -1
  381. package/utils.cjs.js +0 -1280
  382. package/utils.cjs.js.map +0 -1
  383. package/utils.js +0 -1248
  384. package/utils.js.map +0 -1
  385. /package/{src/translations → translations}/en.json +0 -0
@@ -1,4915 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var react = require('@honeybadger-io/react');
7
- var neetoui = require('@bigbinary/neetoui');
8
- var ramda = require('ramda');
9
- var reactI18next = require('react-i18next');
10
- var ErrorPage = require('@bigbinary/neeto-molecules/ErrorPage');
11
- var reactRouterDom = require('react-router-dom');
12
- var neetoCist = require('@bigbinary/neeto-cist');
13
- var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
14
- var axios = require('axios');
15
- var utils = require('@bigbinary/neeto-commons-frontend/utils');
16
- var reactQuery = require('react-query');
17
- var qs = require('qs');
18
- var reactHelmet = require('react-helmet');
19
-
20
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
-
22
- function _interopNamespace(e) {
23
- if (e && e.__esModule) return e;
24
- var n = Object.create(null);
25
- if (e) {
26
- Object.keys(e).forEach(function (k) {
27
- if (k !== 'default') {
28
- var d = Object.getOwnPropertyDescriptor(e, k);
29
- Object.defineProperty(n, k, d.get ? d : {
30
- enumerable: true,
31
- get: function () { return e[k]; }
32
- });
33
- }
34
- });
35
- }
36
- n["default"] = e;
37
- return Object.freeze(n);
38
- }
39
-
40
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
41
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
- var ErrorPage__default = /*#__PURE__*/_interopDefaultLegacy(ErrorPage);
43
- var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
44
-
45
- var IGNORABLE_ERRORS_REGEX = /(window\.requestAnimationFrame|ResizeObserver|ChunkLoadError|window\.webkit\.messageHandlers|Request aborted|Network Error)/;
46
-
47
- var _path, _path2, _path3, _path4, _path5, _path6;
48
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
49
- var SvgFallbackComponent = function SvgFallbackComponent(props) {
50
- return /*#__PURE__*/React__namespace.createElement("svg", _extends({
51
- width: 230,
52
- height: 230,
53
- viewBox: "0 0 317 320",
54
- fill: "none",
55
- xmlns: "http://www.w3.org/2000/svg",
56
- role: "img"
57
- }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
58
- d: "M271.071 28.008c-8.563-12.544-25.317-10.81-38.577-10.717-30.899.206-159.103.047-168.105.497-13.866.713-27.79 6.33-30.041 20.132-1.216 7.456-.14 15.427.139 22.94 1.118 30.417 1.953 68.044 5.7 95.148 1.016 7.372 2.35 14.761 6.936 20.853 7.238 9.618 21.581 12.998 33.616 13.2.141.236 110.261 2.828 150.068-.154 11.579-.87 25.682-1.74 33.488-11.652 3.913-4.971 4.246-12.136 5.028-18.171 2.816-21.653 4.695-58.296 7.156-97.59.703-11.222 1.25-24.736-5.408-34.486Zm3.044 27.34c-.082 4.493-3.429 57.629-3.648 60.853-.746 10.901-3.144 45.195-6.244 55.905-3.064 10.571-16.833 13.173-26.189 14.167-7.926.857-15.906 1.35-23.877 1.608-40.911 1.322-129.772 1.044-133.332.949-14.415-.663-30.588-4.888-36.021-19.843a81.026 81.026 0 0 1-3.298-20.918c-2.712-32.616-2.294-42.461-4.372-92.667-.293-7.188-1.76-15.638 1.536-22.356C45.898 18.356 67.727 20.417 81.1 20.27c15.73-.172 149.231-.271 157.495-.338 7.347-.06 15.278-.433 22.12 2.756 12.343 5.744 13.613 20.671 13.399 32.649v.01Z",
59
- fill: "#2F3941"
60
- })), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
61
- d: "M220.642 50.4a1.586 1.586 0 0 0-.415-1.21 1.607 1.607 0 0 0-1.177-.52c-35.537-.183-99.035-.669-135.303-.466a1.056 1.056 0 0 0-.76.238 1.044 1.044 0 0 0-.373.699c-.43 34.284-.24 68.58-.24 102.862 0 1.636.685 2.122 1.643 2.162 45.113 2.049 92.2.763 137.476.91a2.342 2.342 0 0 0 1.518-.675c.405-.403.648-.94.68-1.509-.443-33.909-1.227-68.635-3.049-102.49Zm-2.277.78c1.187 24.763 1.712 49.901 2.264 74.806-45.853 1.664-90.202.658-135.787.522 0-24.642-.313-50.868 0-76.093 43.482.375 89.992.537 133.523.764ZM91.463 151.855l16.27-22.423 18.964.294c-3.709 5.108-12.138 17.321-14.959 22.512-6.749-.114-20.275-.383-20.275-.383Zm42.769.671 15.24-22.699c6.347 0 12.699-.04 19.055-.12-3.627 6.705-10.492 16.8-14.739 22.976-6.51-.007-13.028-.059-19.556-.157Zm42.469.228c5.503-8.232 10.238-15.419 16.186-23.434 6.993-.163 13.993-.365 20.998-.605-4.761 6.22-12.597 17.04-15.361 23.986-7.274.037-14.548.054-21.823.053Z",
62
- fill: "#2F3941"
63
- })), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
64
- d: "M153.904 69.903c-3.722-.185-22.748 30.824-20.049 34.788 2.493 3.664 37.821 2.965 39.914 0 2.39-3.436-16.031-34.596-19.865-34.788Zm.745 10.224c.19 2.645.576 11.328.205 13.546-.27 1.633-1.778.747-1.796-.113-.065-4.437-.177-8.883-.27-13.32a.957.957 0 0 1 .224-.699.925.925 0 0 1 1.551.221.973.973 0 0 1 .086.365Zm.707 18.984c-.727 2.011-2.791 1.389-2.791-.259-.057-3.119 3.572-1.901 2.791.26v-.001ZM155.392 199.891c1.926 4.35 9.139 2.15 6.621-3.658a3.653 3.653 0 0 0-2.338-2.083 3.669 3.669 0 0 0-3.092.487c-1.534 1.051-2.876 3.875-1.144 5.376a.499.499 0 0 0 .85-.353c.107-1.148-.119-2.371.838-3.231a2.288 2.288 0 0 1 3.549.378 2.661 2.661 0 0 1-.467 3.601 3.032 3.032 0 0 1-4.019-.994c-.313-.517-1.037-.06-.798.477ZM145.571 226.664c3.876.66 7.809.928 11.739.798 4.292.127 8.604.273 12.894.248a1.103 1.103 0 0 0 0-2.204c-4.29-.174-8.602-.186-12.894-.206a57.817 57.817 0 0 0-11.739.39.508.508 0 0 0 0 .974Z",
65
- fill: "#2F3941"
66
- })), _path4 || (_path4 = /*#__PURE__*/React__namespace.createElement("path", {
67
- d: "M290.099 17.651a26.343 26.343 0 0 0-14.443-13.727c-8.184-3.209-17.301-2.702-25.923-2.622-36.725.338-187.491.226-197.868.656a46.93 46.93 0 0 0-23.035 6.39c-15.658 9.89-12.084 26.386-11.458 44.885 1.203 35.566 2.12 79.713 6.107 111.322 1.049 8.324 2.204 16.755 6.676 24.05 7.983 13.016 24.148 17.93 39.357 17.867.586 0 34.396.811 73.168 1.099.06 2.045.465 4.305.694 6.462-.845-.102-23.612.467-30.303 1.419a.956.956 0 0 0-.771.893.982.982 0 0 0 .07.415c-3.429 2.898-6.462 6.492-9.588 9.661-3.848 3.879-7.906 7.645-11.5 11.758a.822.822 0 0 0 1.163 1.163c4.026-3.696 7.685-7.846 11.473-11.786 3.151-3.283 6.762-6.462 9.603-10.051a284.168 284.168 0 0 1 30.012-1.086c.02 1.633-.067 3.567 1.553 4.394.249.132.684.04.731-.3.119-2.158.03-4.322-.266-6.463a20.308 20.308 0 0 0-1.205-6.462c9.037.065 18.32.097 27.494.082a22.04 22.04 0 0 0-.498 11.488.589.589 0 0 0 .558.411.583.583 0 0 0 .558-.411c.323-1.081.516-2.196.575-3.323 5.085.679 9.298.204 22.997 1.059 2.081.132 5.048.161 6.8.151a49.891 49.891 0 0 0 9.03 9.507 126.265 126.265 0 0 0 10.551 9.276c.89.671 1.988-.798 1.188-1.541-3.547-3.244-7.275-6.278-10.814-9.542a93.19 93.19 0 0 0-8.62-8.122.687.687 0 0 0-.296-.8 16.466 16.466 0 0 0-6.571-1.034 303.46 303.46 0 0 0-8.896-.433 119.194 119.194 0 0 0-15.245-.532c.139-2.202.522-4.237.539-6.156 26.179-.057 51.28-.512 67.03-1.762 13.367-1.064 29.723-1.842 38.877-13.173 4.737-5.858 5.182-13.963 6.112-21.166 3.929-30.407 5.575-77.387 8.06-112.188.997-13.655 2.17-28.933-3.676-41.728Zm1.613 31.317c-.146 4.2-3.837 64.939-4.225 70.999-.84 12.757-3.594 52.564-7.069 65.039-3.355 12.052-18.191 15.578-28.953 16.886-9.22 1.123-18.553 1.715-27.836 2.028-47.201 1.6-152.146 1.016-154.02.947-17.12-.746-35.33-6.288-41.204-24.174-2.597-7.906-2.91-16.548-3.567-24.799-2.594-32.741-2.42-43.205-4.722-107.053-.313-8.463-1.814-17.863.596-26.12C26.38 3.355 51.897 4.623 67.642 4.416c18.621-.248 177.824-.437 187.33-.497 8.565-.045 17.791.174 25.046 5.349 12.02 8.565 12.159 26.432 11.694 39.692v.008ZM2.113 306.233c1.504-2.13 36.665-41.756 38.413-43.727a10.606 10.606 0 0 1 9.066-3.728c23.95-.139 47.907-.29 71.857.095 44.688.73 142.992-1.775 146.288-1.74 3.231.032 7.399-.711 9.864 1.66 2.352 2.264 26.674 35.343 35.177 44.204 1.322 1.374 3.407-.716 2.093-2.093-8.324-8.682-29.105-36.658-32.5-40.888a17.18 17.18 0 0 0-4.722-5.016c-4.243-2.115-53.46.465-74.499.942-24.904.57-18.499.127-150.918.092-5.858 0-10.004.249-13.864 5.043-4.439 5.52-35.989 42.114-37.403 44.477-.44.751.663 1.365 1.148.679ZM310.594 315.641c2.172-3.694 6.668-9.738 4.511-10.439-3.336-1.064-312.387 1.784-312.387 1.784s-5.946.154-.249 5.456c5.697 5.301 5.965 6.656 16.25 6.258 10.284-.397 262.609-1.203 269.642-1.091 7.034.112 20.856.37 22.233-1.968Z",
68
- fill: "#2F3941"
69
- })), _path5 || (_path5 = /*#__PURE__*/React__namespace.createElement("path", {
70
- d: "M34.938 281.227c-2.187 2.709-11.898 12.69-12.29 15.161a1.074 1.074 0 0 0 .471 1.163c1.328.85 41.622 0 50.602-.032 18.968-.08 153.463.745 156.865.79 2.603.032 4.444-.519 3.169-3.435-4.347-9.942-8.664-19.883-13.081-29.795-1.123-2.513-2.02-2.851-4.722-2.839 0 0-161.347 0-166.45-.059a.918.918 0 0 0-.874.921.92.92 0 0 0 .874.92c31.896.311 159.016-.087 167.966.445.724.045-.248-1.638 13.958 30.395.199.445.147 1.242-2.207 1.3-1.633.034-157.686-.624-193.429-.358-1.899 0-9.956.338-9.897-.14.2-1.6 12.619-14.798 23.217-31.038.365-.559-.497-1.016-.875-.512-.02-.007-8.443 11.098-13.297 17.113ZM238.084 290.689a39.103 39.103 0 0 0 3.124 6.895c.746 1.022 1.243 1.009 2.486 1.049 6.929.216 26.206-.664 45.483-.286 1.275.027 6.532.83 6.463-1.243-.102-3.042-9.343-13.789-22.084-33.67-1.454-2.272-2.08-2.411-4.956-2.284-4.702.199-32.4 1.195-41.541 1.491-1.216.04-1.223 1.934 0 1.894 47.176-1.491 43.545-1.605 43.833-1.422.93.592 1.862 2.879 2.458 3.793 1.33 2.021 17.513 26.115 18.981 28.222.878 1.256.02 1.183-1.739 1.149-1.989-.045-45.168.233-46.573.221-1.739-.022-2.589-3.415-3.3-4.931-9.112-19.476-10.563-22.476-13.054-26.54-.392-.638-1.409-.445-1.131.207 4.36 10.205 7.591 16.5 11.55 25.455ZM285.242 112.053v.445c0 .04.067.04.067 0 0-.147 0-.298.02-.445-.002-.047-.087-.052-.087 0ZM91.163 240.165s131.381-1.695 132.656-1.416c1.275.278-.313 8.776-4.226 8.751-3.912-.025-121.276.922-123.175.171-1.9-.75-7.28-7.478-5.255-7.506Z",
71
- fill: "#2F3941"
72
- })), _path6 || (_path6 = /*#__PURE__*/React__namespace.createElement("path", {
73
- d: "M45.82 293.676a.023.023 0 0 0 .014-.01.025.025 0 0 0 .005-.016.027.027 0 0 0-.019-.026.027.027 0 0 0-.014.042.023.023 0 0 0 .014.01ZM220.834 284.323c-2.237-.034-6-.062-10.973-.082-1.198-2.995.522 1.459-4.325-10.759 4.354 0 7.692 0 9.735.025a.767.767 0 0 0 .545-.226.767.767 0 0 0 0-1.09.77.77 0 0 0-.545-.225c-2.09-.03-5.666-.057-10.376-.077-1.134-2.734-1.506-3.154-2.411-3.637a.552.552 0 0 0-.798.319c-.291.832-.328 1.339.355 3.308-8.714-.03-20.504-.047-33.677-.05a23.38 23.38 0 0 0-2.021-4.446.51.51 0 0 0-.566-.224.509.509 0 0 0-.383.472c.033 1.409.199 2.811.497 4.188-11.212 0-23.326 0-35.336.027a706.988 706.988 0 0 0-.186-3.171.582.582 0 0 0-1.161 0 442.255 442.255 0 0 0-.313 3.174c-12.514.017-24.854.045-35.902.079a6.379 6.379 0 0 0-.378-2.835c-.107-.266-.457-.443-.676-.187a6.309 6.309 0 0 0-1.322 3.03c-12.572.042-23.276.094-30.335.154a18.732 18.732 0 0 0 1.8-3.577c.372-1.061-1.22-2.03-1.954-1.128-1.223 1.511-2.374 3.112-3.495 4.742-2.634.03-4.386.062-5.067.095a.503.503 0 0 0-.357.861.503.503 0 0 0 .357.148c1.155.087 2.55.164 4.158.236-5.903 8.771-5.418 7.829-7.526 11.008-3.607.032-5.985.067-6.83.104a.503.503 0 0 0-.505.505.505.505 0 0 0 .505.504c1.39.1 3.4.184 5.94.249a48.466 48.466 0 0 0-3.343 6.094.431.431 0 0 0 .746.433c1.491-2.168 3.149-4.337 4.859-6.462 8.45.191 21.417.268 36.556.28a22.934 22.934 0 0 0-1.295 5.891c-.048.723.89.823 1.242.338a22.61 22.61 0 0 0 2.963-6.214c12.082 0 25.401-.03 38.835-.079a13.904 13.904 0 0 0 .698 6.238.857.857 0 0 0 .746.429.857.857 0 0 0 .746-.429 13.875 13.875 0 0 0 .952-6.251c13.227-.052 26.474-.116 38.666-.171a25.556 25.556 0 0 0 2.281 5.572.781.781 0 0 0 1.442-.392 24.472 24.472 0 0 0-.816-5.193c13.586-.062 25.705-.111 34.797-.114a27.226 27.226 0 0 0 3.362 6.462c.353.47 1.362.41 1.283-.345a25.886 25.886 0 0 0-1.554-6.119c4.439 0 7.974.022 10.37.059a.761.761 0 0 0 .543-.229.766.766 0 0 0 .222-.546.77.77 0 0 0-.775-.766Zm-170.101.139c3.142-3.859 6.303-7.563 8.562-10.853 7.58.248 18.36.358 30.772.4a97.23 97.23 0 0 1-3.278 10.287c-15.024.045-27.84.102-36.056.166Zm38.892-.173c2.341-7.884 2.585-7.954 3.072-10.273 11.167.028 23.527 0 35.999-.057-.562 6.246-.38 6.529-.691 10.247-13.287.02-26.457.048-38.38.083Zm41.303-.087c-.144-3.319.03-4.226-.263-10.253 12.178-.057 24.392-.142 35.668-.221.621 2.423-.107-.639 2.838 10.439-12.059.01-25.167.017-38.243.035Zm41.164-.023c-.072-.248-3.022-10.14-3.122-10.471 13.235-.094 25.019-.181 33.668-.216 1.941 5.087 1.325 3.139 4.136 10.737-9.003-.032-21.099-.047-34.682-.05ZM281.202 286.259c-1.339-.479-2.53-.671-8.326-.591a140.94 140.94 0 0 0-7.491-12.89 25.902 25.902 0 0 0 7.379-.656.778.778 0 0 0 .398-1.209.778.778 0 0 0-.398-.282c-2.98-.66-6.05-.813-9.081-.452a201.697 201.697 0 0 0-2.486-3.634.674.674 0 0 0-1.163.679l1.695 3.022c-4.143.151-10.849.437-15.243.636a24.566 24.566 0 0 0-3.679-4.576.437.437 0 0 0-.251-.114.444.444 0 0 0-.479.539 25.034 25.034 0 0 0 1.613 4.28 45.342 45.342 0 0 0-8.833.763.515.515 0 0 0-.365.489.511.511 0 0 0 .365.488c3.286.677 6.655.86 9.996.542 1.327 2.443 2.833 4.824 4.079 7.126 1.006 1.854 1.953 3.842 2.965 5.798a40.865 40.865 0 0 0-9.527.716.499.499 0 0 0-.405.488.496.496 0 0 0 .405.489c3.549.665 7.169.868 10.769.604a28.675 28.675 0 0 0 3.542 5.078c.37.412.962-.035.868-.498a23.462 23.462 0 0 0-1.452-4.583 1830.64 1830.64 0 0 0 15.658-.134 30.665 30.665 0 0 0 2.662 4.012c.378.497 1.283.248 1.076-.45a29.948 29.948 0 0 0-1.337-3.587 23.018 23.018 0 0 0 7.071-.599.775.775 0 0 0 .542-.756.78.78 0 0 0-.567-.738Zm-26.223-.126c-1.213-2.414-2.63-4.75-3.865-6.989-1.029-1.859-2.068-3.91-3.211-5.911 3.728-.082 8.656-.218 15.263-.4 3.599 6.462 5.696 10.337 7.091 12.882-3.291.047-6.51.157-15.278.408v.01Z",
74
- fill: "#2F3941"
75
- })));
76
- };
77
-
78
- var FallbackComponent = function FallbackComponent() {
79
- var _useTranslation = reactI18next.useTranslation(),
80
- t = _useTranslation.t;
81
- React.useEffect(function () {
82
- var listener = function listener(e) {
83
- var _e$target;
84
- if (ramda.isNil(e.state)) return;
85
- window.location.href = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.location.href;
86
- };
87
- window.addEventListener("popstate", listener);
88
- return function () {
89
- return window.removeEventListener("popstate", listener);
90
- };
91
- }, []);
92
- return /*#__PURE__*/React__default["default"].createElement("div", {
93
- className: "flex h-screen w-full flex-row items-start justify-start"
94
- }, /*#__PURE__*/React__default["default"].createElement("div", {
95
- className: "m-auto text-center"
96
- }, /*#__PURE__*/React__default["default"].createElement("div", {
97
- className: "m-auto mb-8 flex items-center justify-center"
98
- }, /*#__PURE__*/React__default["default"].createElement(SvgFallbackComponent, null)), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
99
- className: "mb-4",
100
- component: "h2",
101
- style: "h2",
102
- weight: "semibold"
103
- }, t("neetoCommons.fallbackComponent.somethingWentWrong")), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
104
- className: "neeto-ui-text-gray-600 mb-8",
105
- component: "p",
106
- style: "body1",
107
- weight: "normal"
108
- }, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
109
- i18nKey: "neetoCommons.fallbackComponent.description",
110
- components: {
111
- reloading: /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
112
- style: "link",
113
- onClick: function onClick() {
114
- return window.location.reload();
115
- }
116
- }),
117
- contactus: /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
118
- style: "link",
119
- onClick: function onClick() {
120
- var _window$NeetoChat, _window$NeetoChat$con, _window$NeetoChat2, _window$NeetoChat2$co;
121
- (_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 ? void 0 : (_window$NeetoChat$con = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat$con === void 0 ? void 0 : _window$NeetoChat$con.maximizeWidget();
122
- (_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 ? void 0 : (_window$NeetoChat2$co = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2$co === void 0 ? void 0 : _window$NeetoChat2$co.openWidget();
123
- }
124
- })
125
- }
126
- }))));
127
- };
128
-
129
- var attachContext = function attachContext(notice, context) {
130
- if (notice.context) Object.assign(notice.context, context);else notice.context = context;
131
- };
132
- var getSessionReplayUrl = function getSessionReplayUrl() {
133
- var storage = sessionStorage.getItem("neeto-replay-widget--session");
134
- var currentTimestamp = new Date().getTime();
135
- return storage ? "".concat(JSON.parse(storage).url, "?goto=").concat(currentTimestamp) : "";
136
- };
137
-
138
- /** @type {import("neetocommons/react-utils").HoneybadgerErrorBoundary} */
139
- var HoneybadgerErrorBoundary = function HoneybadgerErrorBoundary(_ref) {
140
- var children = _ref.children,
141
- _ref$ErrorComponent = _ref.ErrorComponent,
142
- ErrorComponent = _ref$ErrorComponent === void 0 ? FallbackComponent : _ref$ErrorComponent,
143
- _ref$filterErrors = _ref.filterErrors,
144
- filterErrors = _ref$filterErrors === void 0 ? undefined : _ref$filterErrors;
145
- react.Honeybadger.beforeNotify(function (notice) {
146
- var _globalProps$user;
147
- if (!notice) return false;
148
- var isIgnorable = IGNORABLE_ERRORS_REGEX.test(notice.message) || notice.stack.includes("chrome-extension://") || (filterErrors === null || filterErrors === void 0 ? void 0 : filterErrors(notice)) === false;
149
- if (isIgnorable) return false;
150
- var context = {};
151
- var user = (_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email;
152
- if (user) context.user = user;
153
- var sessionReplay = getSessionReplayUrl();
154
- if (sessionReplay) context.sessionReplay = sessionReplay;
155
- attachContext(notice, context);
156
- return true;
157
- });
158
- var honeybadger = react.Honeybadger.configure({
159
- apiKey: globalProps.honeybadgerApiKey,
160
- environment: globalProps.railsEnv,
161
- revision: globalProps.honeybadgerRevision,
162
- developmentEnvironments: ["development", "test"],
163
- enableUncaught: true,
164
- async: true,
165
- breadcrumbsEnabled: true,
166
- projectRoot: "webpack:///./",
167
- enableUnhandledRejection: false
168
- });
169
- return /*#__PURE__*/React__default["default"].createElement(react.HoneybadgerErrorBoundary, {
170
- ErrorComponent: ErrorComponent,
171
- honeybadger: honeybadger
172
- }, children);
173
- };
174
-
175
- function _objectWithoutPropertiesLoose(source, excluded) {
176
- if (source == null) return {};
177
- var target = {};
178
- var sourceKeys = Object.keys(source);
179
- var key, i;
180
- for (i = 0; i < sourceKeys.length; i++) {
181
- key = sourceKeys[i];
182
- if (excluded.indexOf(key) >= 0) continue;
183
- target[key] = source[key];
184
- }
185
- return target;
186
- }
187
-
188
- function _objectWithoutProperties(source, excluded) {
189
- if (source == null) return {};
190
- var target = _objectWithoutPropertiesLoose(source, excluded);
191
- var key, i;
192
- if (Object.getOwnPropertySymbols) {
193
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
194
- for (i = 0; i < sourceSymbolKeys.length; i++) {
195
- key = sourceSymbolKeys[i];
196
- if (excluded.indexOf(key) >= 0) continue;
197
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
198
- target[key] = source[key];
199
- }
200
- }
201
- return target;
202
- }
203
-
204
- var _excluded$1 = ["condition", "redirectRoute", "errorPage", "permissions"];
205
- var PrivateRoute = function PrivateRoute(_ref) {
206
- var _ref$condition = _ref.condition,
207
- condition = _ref$condition === void 0 ? globalProps.authenticated : _ref$condition,
208
- _ref$redirectRoute = _ref.redirectRoute,
209
- redirectRoute = _ref$redirectRoute === void 0 ? undefined : _ref$redirectRoute,
210
- _ref$errorPage = _ref.errorPage,
211
- errorPage = _ref$errorPage === void 0 ? undefined : _ref$errorPage,
212
- _ref$permissions = _ref.permissions,
213
- permissions = _ref$permissions === void 0 ? undefined : _ref$permissions,
214
- props = _objectWithoutProperties(_ref, _excluded$1);
215
- if (condition) {
216
- if (permissions) {
217
- return globalProps.permissions.some(ramda.includes(ramda.__, permissions)) ? /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Route, props) : errorPage || /*#__PURE__*/React__default["default"].createElement(ErrorPage__default["default"], {
218
- status: 403
219
- });
220
- }
221
- return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Route, props);
222
- }
223
- if (redirectRoute) {
224
- return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Redirect, {
225
- to: {
226
- pathname: redirectRoute
227
- }
228
- });
229
- }
230
- return errorPage || /*#__PURE__*/React__default["default"].createElement(ErrorPage__default["default"], {
231
- status: 403
232
- });
233
- };
234
-
235
- function _typeof$1(obj) {
236
- "@babel/helpers - typeof";
237
-
238
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
239
- return typeof obj;
240
- } : function (obj) {
241
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
242
- }, _typeof$1(obj);
243
- }
244
-
245
- function _toPrimitive(input, hint) {
246
- if (_typeof$1(input) !== "object" || input === null) return input;
247
- var prim = input[Symbol.toPrimitive];
248
- if (prim !== undefined) {
249
- var res = prim.call(input, hint || "default");
250
- if (_typeof$1(res) !== "object") return res;
251
- throw new TypeError("@@toPrimitive must return a primitive value.");
252
- }
253
- return (hint === "string" ? String : Number)(input);
254
- }
255
-
256
- function _toPropertyKey(arg) {
257
- var key = _toPrimitive(arg, "string");
258
- return _typeof$1(key) === "symbol" ? key : String(key);
259
- }
260
-
261
- function _defineProperty(obj, key, value) {
262
- key = _toPropertyKey(key);
263
- if (key in obj) {
264
- Object.defineProperty(obj, key, {
265
- value: value,
266
- enumerable: true,
267
- configurable: true,
268
- writable: true
269
- });
270
- } else {
271
- obj[key] = value;
272
- }
273
- return obj;
274
- }
275
-
276
- var fetch = function fetch() {
277
- return axios__default["default"].get("/api/v1/neeto_apps");
278
- };
279
- var neetoAppsApi = {
280
- fetch: fetch
281
- };
282
-
283
- var QUERY_KEYS = {
284
- NEETO_APPS_LIST: "neeto-apps-list"
285
- };
286
-
287
- var QUERY_CACHE_NAME_SPACE = "queryCache";
288
- var NEETO_APPS_LIST_STALE_TIME = 30 * 24 * 60 * 60 * 1000; // 30 days
289
-
290
- function ownKeys$3(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; }
291
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
292
- var useFetchNeetoApps = function useFetchNeetoApps(options) {
293
- var _globalProps$user;
294
- var scopedQueryKey = "".concat(QUERY_KEYS.NEETO_APPS_LIST, "-").concat((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id);
295
- var neetoApps = reactUtils.usePersistedQuery.getCache(scopedQueryKey);
296
- return reactUtils.usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, _objectSpread$3({
297
- staleTime: NEETO_APPS_LIST_STALE_TIME,
298
- enabled: neetoCist.isNotPresent(neetoApps === null || neetoApps === void 0 ? void 0 : neetoApps.data)
299
- }, options));
300
- };
301
-
302
- function ownKeys$2(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; }
303
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
304
- var localStorageQueryCache = {
305
- set: function set(key, data) {
306
- var cache = localStorageQueryCache.getAll();
307
- var newCache = _objectSpread$2(_objectSpread$2({}, cache), {}, _defineProperty({}, key, {
308
- data: data,
309
- modifiedAt: Date.now()
310
- }));
311
- localStorage.setItem(QUERY_CACHE_NAME_SPACE, JSON.stringify(newCache));
312
- },
313
- getAll: function getAll() {
314
- var cache = utils.getFromLocalStorage(QUERY_CACHE_NAME_SPACE);
315
- if (!cache) return {};
316
- return cache;
317
- },
318
- get: function get(key) {
319
- return localStorageQueryCache.getAll()[key];
320
- }
321
- };
322
- var isOutdated = function isOutdated(localCache, staleTime) {
323
- if (ramda.isNil(localCache)) return true;
324
- if (ramda.isNil(staleTime)) return false;
325
- return localCache.modifiedAt <= Date.now() - staleTime;
326
- };
327
- var usePersistedQuery = function usePersistedQuery(queryKey, fetch, options) {
328
- var queryResult = reactQuery.useQuery(queryKey, fetch, options);
329
- var localCache = localStorageQueryCache.get(queryKey);
330
- React.useEffect(function () {
331
- if (!queryResult.isSuccess) return;
332
- localStorageQueryCache.set(queryKey, queryResult.data);
333
- }, [queryKey, queryResult.data, queryResult.isSuccess]);
334
- if (isOutdated(localCache, options === null || options === void 0 ? void 0 : options.staleTime)) {
335
- return _objectSpread$2(_objectSpread$2({}, queryResult), {}, {
336
- isFreshLoading: queryResult.isLoading
337
- });
338
- }
339
- return _objectSpread$2(_objectSpread$2({}, queryResult), {}, {
340
- data: queryResult.data || localCache.data,
341
- isFreshLoading: false
342
- });
343
- };
344
- usePersistedQuery.getCache = localStorageQueryCache.get;
345
-
346
- function _arrayWithHoles(arr) {
347
- if (Array.isArray(arr)) return arr;
348
- }
349
-
350
- function _iterableToArrayLimit(arr, i) {
351
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
352
- if (null != _i) {
353
- var _s,
354
- _e,
355
- _x,
356
- _r,
357
- _arr = [],
358
- _n = !0,
359
- _d = !1;
360
- try {
361
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
362
- if (Object(_i) !== _i) return;
363
- _n = !1;
364
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
365
- } catch (err) {
366
- _d = !0, _e = err;
367
- } finally {
368
- try {
369
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
370
- } finally {
371
- if (_d) throw _e;
372
- }
373
- }
374
- return _arr;
375
- }
376
- }
377
-
378
- function _arrayLikeToArray(arr, len) {
379
- if (len == null || len > arr.length) len = arr.length;
380
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
381
- return arr2;
382
- }
383
-
384
- function _unsupportedIterableToArray(o, minLen) {
385
- if (!o) return;
386
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
387
- var n = Object.prototype.toString.call(o).slice(8, -1);
388
- if (n === "Object" && o.constructor) n = o.constructor.name;
389
- if (n === "Map" || n === "Set") return Array.from(o);
390
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
391
- }
392
-
393
- function _nonIterableRest() {
394
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
395
- }
396
-
397
- function _slicedToArray(arr, i) {
398
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
399
- }
400
-
401
- var useDebounce = function useDebounce(value) {
402
- var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 350;
403
- var _useState = React.useState(value),
404
- _useState2 = _slicedToArray(_useState, 2),
405
- debouncedValue = _useState2[0],
406
- setDebouncedValue = _useState2[1];
407
- React.useEffect(function () {
408
- var handler = setTimeout(function () {
409
- setDebouncedValue(value);
410
- }, delay);
411
- return function () {
412
- clearTimeout(handler);
413
- };
414
- }, [value]);
415
- return debouncedValue;
416
- };
417
-
418
- const createStoreImpl = (createState) => {
419
- let state;
420
- const listeners = /* @__PURE__ */ new Set();
421
- const setState = (partial, replace) => {
422
- const nextState = typeof partial === "function" ? partial(state) : partial;
423
- if (!Object.is(nextState, state)) {
424
- const previousState = state;
425
- state = (replace != null ? replace : typeof nextState !== "object") ? nextState : Object.assign({}, state, nextState);
426
- listeners.forEach((listener) => listener(state, previousState));
427
- }
428
- };
429
- const getState = () => state;
430
- const subscribe = (listener) => {
431
- listeners.add(listener);
432
- return () => listeners.delete(listener);
433
- };
434
- const destroy = () => {
435
- if ((undefined && undefined.MODE) !== "production") {
436
- console.warn(
437
- "[DEPRECATED] The destroy method will be unsupported in the future version. You should use unsubscribe function returned by subscribe. Everything will be garbage collected if store is garbage collected."
438
- );
439
- }
440
- listeners.clear();
441
- };
442
- const api = { setState, getState, subscribe, destroy };
443
- state = createState(setState, getState, api);
444
- return api;
445
- };
446
- const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
447
-
448
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
449
-
450
- function getDefaultExportFromCjs (x) {
451
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
452
- }
453
-
454
- var withSelector = {exports: {}};
455
-
456
- var withSelector_production_min = {};
457
-
458
- var shim = {exports: {}};
459
-
460
- var useSyncExternalStoreShim_production_min = {};
461
-
462
- /**
463
- * @license React
464
- * use-sync-external-store-shim.production.min.js
465
- *
466
- * Copyright (c) Facebook, Inc. and its affiliates.
467
- *
468
- * This source code is licensed under the MIT license found in the
469
- * LICENSE file in the root directory of this source tree.
470
- */
471
-
472
- var hasRequiredUseSyncExternalStoreShim_production_min;
473
-
474
- function requireUseSyncExternalStoreShim_production_min () {
475
- if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
476
- hasRequiredUseSyncExternalStoreShim_production_min = 1;
477
- var e=React__default["default"];function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c});},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c});})},[a]);p(d);return d}
478
- function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k(a,d)}catch(f){return !0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;useSyncExternalStoreShim_production_min.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
479
- return useSyncExternalStoreShim_production_min;
480
- }
481
-
482
- var useSyncExternalStoreShim_development = {};
483
-
484
- /**
485
- * @license React
486
- * use-sync-external-store-shim.development.js
487
- *
488
- * Copyright (c) Facebook, Inc. and its affiliates.
489
- *
490
- * This source code is licensed under the MIT license found in the
491
- * LICENSE file in the root directory of this source tree.
492
- */
493
-
494
- var hasRequiredUseSyncExternalStoreShim_development;
495
-
496
- function requireUseSyncExternalStoreShim_development () {
497
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
498
- hasRequiredUseSyncExternalStoreShim_development = 1;
499
-
500
- if (process.env.NODE_ENV !== "production") {
501
- (function() {
502
-
503
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
504
- if (
505
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
506
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
507
- 'function'
508
- ) {
509
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
510
- }
511
- var React = React__default["default"];
512
-
513
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
514
-
515
- function error(format) {
516
- {
517
- {
518
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
519
- args[_key2 - 1] = arguments[_key2];
520
- }
521
-
522
- printWarning('error', format, args);
523
- }
524
- }
525
- }
526
-
527
- function printWarning(level, format, args) {
528
- // When changing this logic, you might want to also
529
- // update consoleWithStackDev.www.js as well.
530
- {
531
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
532
- var stack = ReactDebugCurrentFrame.getStackAddendum();
533
-
534
- if (stack !== '') {
535
- format += '%s';
536
- args = args.concat([stack]);
537
- } // eslint-disable-next-line react-internal/safe-string-coercion
538
-
539
-
540
- var argsWithFormat = args.map(function (item) {
541
- return String(item);
542
- }); // Careful: RN currently depends on this prefix
543
-
544
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
545
- // breaks IE9: https://github.com/facebook/react/issues/13610
546
- // eslint-disable-next-line react-internal/no-production-logging
547
-
548
- Function.prototype.apply.call(console[level], console, argsWithFormat);
549
- }
550
- }
551
-
552
- /**
553
- * inlined Object.is polyfill to avoid requiring consumers ship their own
554
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
555
- */
556
- function is(x, y) {
557
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
558
- ;
559
- }
560
-
561
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
562
-
563
- // dispatch for CommonJS interop named imports.
564
-
565
- var useState = React.useState,
566
- useEffect = React.useEffect,
567
- useLayoutEffect = React.useLayoutEffect,
568
- useDebugValue = React.useDebugValue;
569
- var didWarnOld18Alpha = false;
570
- var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
571
- // because of a very particular set of implementation details and assumptions
572
- // -- change any one of them and it will break. The most important assumption
573
- // is that updates are always synchronous, because concurrent rendering is
574
- // only available in versions of React that also have a built-in
575
- // useSyncExternalStore API. And we only use this shim when the built-in API
576
- // does not exist.
577
- //
578
- // Do not assume that the clever hacks used by this hook also work in general.
579
- // The point of this shim is to replace the need for hacks by other libraries.
580
-
581
- function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
582
- // React do not expose a way to check if we're hydrating. So users of the shim
583
- // will need to track that themselves and return the correct value
584
- // from `getSnapshot`.
585
- getServerSnapshot) {
586
- {
587
- if (!didWarnOld18Alpha) {
588
- if (React.startTransition !== undefined) {
589
- didWarnOld18Alpha = true;
590
-
591
- error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
592
- }
593
- }
594
- } // Read the current snapshot from the store on every render. Again, this
595
- // breaks the rules of React, and only works here because of specific
596
- // implementation details, most importantly that updates are
597
- // always synchronous.
598
-
599
-
600
- var value = getSnapshot();
601
-
602
- {
603
- if (!didWarnUncachedGetSnapshot) {
604
- var cachedValue = getSnapshot();
605
-
606
- if (!objectIs(value, cachedValue)) {
607
- error('The result of getSnapshot should be cached to avoid an infinite loop');
608
-
609
- didWarnUncachedGetSnapshot = true;
610
- }
611
- }
612
- } // Because updates are synchronous, we don't queue them. Instead we force a
613
- // re-render whenever the subscribed state changes by updating an some
614
- // arbitrary useState hook. Then, during render, we call getSnapshot to read
615
- // the current value.
616
- //
617
- // Because we don't actually use the state returned by the useState hook, we
618
- // can save a bit of memory by storing other stuff in that slot.
619
- //
620
- // To implement the early bailout, we need to track some things on a mutable
621
- // object. Usually, we would put that in a useRef hook, but we can stash it in
622
- // our useState hook instead.
623
- //
624
- // To force a re-render, we call forceUpdate({inst}). That works because the
625
- // new object always fails an equality check.
626
-
627
-
628
- var _useState = useState({
629
- inst: {
630
- value: value,
631
- getSnapshot: getSnapshot
632
- }
633
- }),
634
- inst = _useState[0].inst,
635
- forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
636
- // in the layout phase so we can access it during the tearing check that
637
- // happens on subscribe.
638
-
639
-
640
- useLayoutEffect(function () {
641
- inst.value = value;
642
- inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
643
- // commit phase if there was an interleaved mutation. In concurrent mode
644
- // this can happen all the time, but even in synchronous mode, an earlier
645
- // effect may have mutated the store.
646
-
647
- if (checkIfSnapshotChanged(inst)) {
648
- // Force a re-render.
649
- forceUpdate({
650
- inst: inst
651
- });
652
- }
653
- }, [subscribe, value, getSnapshot]);
654
- useEffect(function () {
655
- // Check for changes right before subscribing. Subsequent changes will be
656
- // detected in the subscription handler.
657
- if (checkIfSnapshotChanged(inst)) {
658
- // Force a re-render.
659
- forceUpdate({
660
- inst: inst
661
- });
662
- }
663
-
664
- var handleStoreChange = function () {
665
- // TODO: Because there is no cross-renderer API for batching updates, it's
666
- // up to the consumer of this library to wrap their subscription event
667
- // with unstable_batchedUpdates. Should we try to detect when this isn't
668
- // the case and print a warning in development?
669
- // The store changed. Check if the snapshot changed since the last time we
670
- // read from the store.
671
- if (checkIfSnapshotChanged(inst)) {
672
- // Force a re-render.
673
- forceUpdate({
674
- inst: inst
675
- });
676
- }
677
- }; // Subscribe to the store and return a clean-up function.
678
-
679
-
680
- return subscribe(handleStoreChange);
681
- }, [subscribe]);
682
- useDebugValue(value);
683
- return value;
684
- }
685
-
686
- function checkIfSnapshotChanged(inst) {
687
- var latestGetSnapshot = inst.getSnapshot;
688
- var prevValue = inst.value;
689
-
690
- try {
691
- var nextValue = latestGetSnapshot();
692
- return !objectIs(prevValue, nextValue);
693
- } catch (error) {
694
- return true;
695
- }
696
- }
697
-
698
- function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
699
- // Note: The shim does not use getServerSnapshot, because pre-18 versions of
700
- // React do not expose a way to check if we're hydrating. So users of the shim
701
- // will need to track that themselves and return the correct value
702
- // from `getSnapshot`.
703
- return getSnapshot();
704
- }
705
-
706
- var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
707
-
708
- var isServerEnvironment = !canUseDOM;
709
-
710
- var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
711
- var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
712
-
713
- useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
714
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
715
- if (
716
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
717
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
718
- 'function'
719
- ) {
720
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
721
- }
722
-
723
- })();
724
- }
725
- return useSyncExternalStoreShim_development;
726
- }
727
-
728
- var hasRequiredShim;
729
-
730
- function requireShim () {
731
- if (hasRequiredShim) return shim.exports;
732
- hasRequiredShim = 1;
733
- (function (module) {
734
-
735
- if (process.env.NODE_ENV === 'production') {
736
- module.exports = requireUseSyncExternalStoreShim_production_min();
737
- } else {
738
- module.exports = requireUseSyncExternalStoreShim_development();
739
- }
740
- } (shim));
741
- return shim.exports;
742
- }
743
-
744
- /**
745
- * @license React
746
- * use-sync-external-store-shim/with-selector.production.min.js
747
- *
748
- * Copyright (c) Facebook, Inc. and its affiliates.
749
- *
750
- * This source code is licensed under the MIT license found in the
751
- * LICENSE file in the root directory of this source tree.
752
- */
753
-
754
- var hasRequiredWithSelector_production_min;
755
-
756
- function requireWithSelector_production_min () {
757
- if (hasRequiredWithSelector_production_min) return withSelector_production_min;
758
- hasRequiredWithSelector_production_min = 1;
759
- var h=React__default["default"],n=requireShim();function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
760
- withSelector_production_min.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f;}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return [function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
761
- u(function(){f.hasValue=!0;f.value=d;},[d]);w(d);return d};
762
- return withSelector_production_min;
763
- }
764
-
765
- var withSelector_development = {};
766
-
767
- /**
768
- * @license React
769
- * use-sync-external-store-shim/with-selector.development.js
770
- *
771
- * Copyright (c) Facebook, Inc. and its affiliates.
772
- *
773
- * This source code is licensed under the MIT license found in the
774
- * LICENSE file in the root directory of this source tree.
775
- */
776
-
777
- var hasRequiredWithSelector_development;
778
-
779
- function requireWithSelector_development () {
780
- if (hasRequiredWithSelector_development) return withSelector_development;
781
- hasRequiredWithSelector_development = 1;
782
-
783
- if (process.env.NODE_ENV !== "production") {
784
- (function() {
785
-
786
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
787
- if (
788
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
789
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
790
- 'function'
791
- ) {
792
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
793
- }
794
- var React = React__default["default"];
795
- var shim = requireShim();
796
-
797
- /**
798
- * inlined Object.is polyfill to avoid requiring consumers ship their own
799
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
800
- */
801
- function is(x, y) {
802
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
803
- ;
804
- }
805
-
806
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
807
-
808
- var useSyncExternalStore = shim.useSyncExternalStore;
809
-
810
- // for CommonJS interop.
811
-
812
- var useRef = React.useRef,
813
- useEffect = React.useEffect,
814
- useMemo = React.useMemo,
815
- useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
816
-
817
- function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
818
- // Use this to track the rendered snapshot.
819
- var instRef = useRef(null);
820
- var inst;
821
-
822
- if (instRef.current === null) {
823
- inst = {
824
- hasValue: false,
825
- value: null
826
- };
827
- instRef.current = inst;
828
- } else {
829
- inst = instRef.current;
830
- }
831
-
832
- var _useMemo = useMemo(function () {
833
- // Track the memoized state using closure variables that are local to this
834
- // memoized instance of a getSnapshot function. Intentionally not using a
835
- // useRef hook, because that state would be shared across all concurrent
836
- // copies of the hook/component.
837
- var hasMemo = false;
838
- var memoizedSnapshot;
839
- var memoizedSelection;
840
-
841
- var memoizedSelector = function (nextSnapshot) {
842
- if (!hasMemo) {
843
- // The first time the hook is called, there is no memoized result.
844
- hasMemo = true;
845
- memoizedSnapshot = nextSnapshot;
846
-
847
- var _nextSelection = selector(nextSnapshot);
848
-
849
- if (isEqual !== undefined) {
850
- // Even if the selector has changed, the currently rendered selection
851
- // may be equal to the new selection. We should attempt to reuse the
852
- // current value if possible, to preserve downstream memoizations.
853
- if (inst.hasValue) {
854
- var currentSelection = inst.value;
855
-
856
- if (isEqual(currentSelection, _nextSelection)) {
857
- memoizedSelection = currentSelection;
858
- return currentSelection;
859
- }
860
- }
861
- }
862
-
863
- memoizedSelection = _nextSelection;
864
- return _nextSelection;
865
- } // We may be able to reuse the previous invocation's result.
866
-
867
-
868
- // We may be able to reuse the previous invocation's result.
869
- var prevSnapshot = memoizedSnapshot;
870
- var prevSelection = memoizedSelection;
871
-
872
- if (objectIs(prevSnapshot, nextSnapshot)) {
873
- // The snapshot is the same as last time. Reuse the previous selection.
874
- return prevSelection;
875
- } // The snapshot has changed, so we need to compute a new selection.
876
-
877
-
878
- // The snapshot has changed, so we need to compute a new selection.
879
- var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
880
- // has changed. If it hasn't, return the previous selection. That signals
881
- // to React that the selections are conceptually equal, and we can bail
882
- // out of rendering.
883
-
884
- // If a custom isEqual function is provided, use that to check if the data
885
- // has changed. If it hasn't, return the previous selection. That signals
886
- // to React that the selections are conceptually equal, and we can bail
887
- // out of rendering.
888
- if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
889
- return prevSelection;
890
- }
891
-
892
- memoizedSnapshot = nextSnapshot;
893
- memoizedSelection = nextSelection;
894
- return nextSelection;
895
- }; // Assigning this to a constant so that Flow knows it can't change.
896
-
897
-
898
- // Assigning this to a constant so that Flow knows it can't change.
899
- var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
900
-
901
- var getSnapshotWithSelector = function () {
902
- return memoizedSelector(getSnapshot());
903
- };
904
-
905
- var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
906
- return memoizedSelector(maybeGetServerSnapshot());
907
- };
908
- return [getSnapshotWithSelector, getServerSnapshotWithSelector];
909
- }, [getSnapshot, getServerSnapshot, selector, isEqual]),
910
- getSelection = _useMemo[0],
911
- getServerSelection = _useMemo[1];
912
-
913
- var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
914
- useEffect(function () {
915
- inst.hasValue = true;
916
- inst.value = value;
917
- }, [value]);
918
- useDebugValue(value);
919
- return value;
920
- }
921
-
922
- withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
923
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
924
- if (
925
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
926
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
927
- 'function'
928
- ) {
929
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
930
- }
931
-
932
- })();
933
- }
934
- return withSelector_development;
935
- }
936
-
937
- (function (module) {
938
-
939
- if (process.env.NODE_ENV === 'production') {
940
- module.exports = requireWithSelector_production_min();
941
- } else {
942
- module.exports = requireWithSelector_development();
943
- }
944
- } (withSelector));
945
-
946
- var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelector.exports);
947
-
948
- const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
949
- function useStore(api, selector = api.getState, equalityFn) {
950
- const slice = useSyncExternalStoreWithSelector(
951
- api.subscribe,
952
- api.getState,
953
- api.getServerState || api.getState,
954
- selector,
955
- equalityFn
956
- );
957
- React.useDebugValue(slice);
958
- return slice;
959
- }
960
- const createImpl = (createState) => {
961
- if ((undefined && undefined.MODE) !== "production" && typeof createState !== "function") {
962
- console.warn(
963
- '[DEPRECATED] Passing a vanilla store will be unsupported in the future version. Please use `import { useStore } from "zustand"` to use the vanilla store in React.'
964
- );
965
- }
966
- const api = typeof createState === "function" ? createStore(createState) : createState;
967
- const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
968
- Object.assign(useBoundStore, api);
969
- return useBoundStore;
970
- };
971
- const create$1 = (createState) => createState ? createImpl(createState) : createImpl;
972
-
973
- var useDisplayErrorPage = function useDisplayErrorPage() {
974
- return useErrorDisplayStore(ramda.prop("showErrorPage"));
975
- };
976
- var useErrorDisplayStore = create$1(function () {
977
- return {
978
- showErrorPage: false,
979
- statusCode: 404,
980
- failedApiUrl: "",
981
- failedApiPath: ""
982
- };
983
- });
984
-
985
- var useFuncDebounce = function useFuncDebounce(func) {
986
- var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 350;
987
- var timer = React.useRef(null);
988
- var debouncedFunc = function debouncedFunc() {
989
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
990
- args[_key] = arguments[_key];
991
- }
992
- clearTimeout(timer.current);
993
- timer.current = setTimeout(function () {
994
- return func.apply(void 0, args);
995
- }, delay);
996
- };
997
- debouncedFunc.cancel = function () {
998
- return clearTimeout(timer.current);
999
- };
1000
- return debouncedFunc;
1001
- };
1002
-
1003
- var mousetrap = {exports: {}};
1004
-
1005
- /*global define:false */
1006
-
1007
- (function (module) {
1008
- /**
1009
- * Copyright 2012-2017 Craig Campbell
1010
- *
1011
- * Licensed under the Apache License, Version 2.0 (the "License");
1012
- * you may not use this file except in compliance with the License.
1013
- * You may obtain a copy of the License at
1014
- *
1015
- * http://www.apache.org/licenses/LICENSE-2.0
1016
- *
1017
- * Unless required by applicable law or agreed to in writing, software
1018
- * distributed under the License is distributed on an "AS IS" BASIS,
1019
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1020
- * See the License for the specific language governing permissions and
1021
- * limitations under the License.
1022
- *
1023
- * Mousetrap is a simple keyboard shortcut library for Javascript with
1024
- * no external dependencies
1025
- *
1026
- * @version 1.6.5
1027
- * @url craig.is/killing/mice
1028
- */
1029
- (function(window, document, undefined$1) {
1030
-
1031
- // Check if mousetrap is used inside browser, if not, return
1032
- if (!window) {
1033
- return;
1034
- }
1035
-
1036
- /**
1037
- * mapping of special keycodes to their corresponding keys
1038
- *
1039
- * everything in this dictionary cannot use keypress events
1040
- * so it has to be here to map to the correct keycodes for
1041
- * keyup/keydown events
1042
- *
1043
- * @type {Object}
1044
- */
1045
- var _MAP = {
1046
- 8: 'backspace',
1047
- 9: 'tab',
1048
- 13: 'enter',
1049
- 16: 'shift',
1050
- 17: 'ctrl',
1051
- 18: 'alt',
1052
- 20: 'capslock',
1053
- 27: 'esc',
1054
- 32: 'space',
1055
- 33: 'pageup',
1056
- 34: 'pagedown',
1057
- 35: 'end',
1058
- 36: 'home',
1059
- 37: 'left',
1060
- 38: 'up',
1061
- 39: 'right',
1062
- 40: 'down',
1063
- 45: 'ins',
1064
- 46: 'del',
1065
- 91: 'meta',
1066
- 93: 'meta',
1067
- 224: 'meta'
1068
- };
1069
-
1070
- /**
1071
- * mapping for special characters so they can support
1072
- *
1073
- * this dictionary is only used incase you want to bind a
1074
- * keyup or keydown event to one of these keys
1075
- *
1076
- * @type {Object}
1077
- */
1078
- var _KEYCODE_MAP = {
1079
- 106: '*',
1080
- 107: '+',
1081
- 109: '-',
1082
- 110: '.',
1083
- 111 : '/',
1084
- 186: ';',
1085
- 187: '=',
1086
- 188: ',',
1087
- 189: '-',
1088
- 190: '.',
1089
- 191: '/',
1090
- 192: '`',
1091
- 219: '[',
1092
- 220: '\\',
1093
- 221: ']',
1094
- 222: '\''
1095
- };
1096
-
1097
- /**
1098
- * this is a mapping of keys that require shift on a US keypad
1099
- * back to the non shift equivelents
1100
- *
1101
- * this is so you can use keyup events with these keys
1102
- *
1103
- * note that this will only work reliably on US keyboards
1104
- *
1105
- * @type {Object}
1106
- */
1107
- var _SHIFT_MAP = {
1108
- '~': '`',
1109
- '!': '1',
1110
- '@': '2',
1111
- '#': '3',
1112
- '$': '4',
1113
- '%': '5',
1114
- '^': '6',
1115
- '&': '7',
1116
- '*': '8',
1117
- '(': '9',
1118
- ')': '0',
1119
- '_': '-',
1120
- '+': '=',
1121
- ':': ';',
1122
- '\"': '\'',
1123
- '<': ',',
1124
- '>': '.',
1125
- '?': '/',
1126
- '|': '\\'
1127
- };
1128
-
1129
- /**
1130
- * this is a list of special strings you can use to map
1131
- * to modifier keys when you specify your keyboard shortcuts
1132
- *
1133
- * @type {Object}
1134
- */
1135
- var _SPECIAL_ALIASES = {
1136
- 'option': 'alt',
1137
- 'command': 'meta',
1138
- 'return': 'enter',
1139
- 'escape': 'esc',
1140
- 'plus': '+',
1141
- 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
1142
- };
1143
-
1144
- /**
1145
- * variable to store the flipped version of _MAP from above
1146
- * needed to check if we should use keypress or not when no action
1147
- * is specified
1148
- *
1149
- * @type {Object|undefined}
1150
- */
1151
- var _REVERSE_MAP;
1152
-
1153
- /**
1154
- * loop through the f keys, f1 to f19 and add them to the map
1155
- * programatically
1156
- */
1157
- for (var i = 1; i < 20; ++i) {
1158
- _MAP[111 + i] = 'f' + i;
1159
- }
1160
-
1161
- /**
1162
- * loop through to map numbers on the numeric keypad
1163
- */
1164
- for (i = 0; i <= 9; ++i) {
1165
-
1166
- // This needs to use a string cause otherwise since 0 is falsey
1167
- // mousetrap will never fire for numpad 0 pressed as part of a keydown
1168
- // event.
1169
- //
1170
- // @see https://github.com/ccampbell/mousetrap/pull/258
1171
- _MAP[i + 96] = i.toString();
1172
- }
1173
-
1174
- /**
1175
- * cross browser add event method
1176
- *
1177
- * @param {Element|HTMLDocument} object
1178
- * @param {string} type
1179
- * @param {Function} callback
1180
- * @returns void
1181
- */
1182
- function _addEvent(object, type, callback) {
1183
- if (object.addEventListener) {
1184
- object.addEventListener(type, callback, false);
1185
- return;
1186
- }
1187
-
1188
- object.attachEvent('on' + type, callback);
1189
- }
1190
-
1191
- /**
1192
- * takes the event and returns the key character
1193
- *
1194
- * @param {Event} e
1195
- * @return {string}
1196
- */
1197
- function _characterFromEvent(e) {
1198
-
1199
- // for keypress events we should return the character as is
1200
- if (e.type == 'keypress') {
1201
- var character = String.fromCharCode(e.which);
1202
-
1203
- // if the shift key is not pressed then it is safe to assume
1204
- // that we want the character to be lowercase. this means if
1205
- // you accidentally have caps lock on then your key bindings
1206
- // will continue to work
1207
- //
1208
- // the only side effect that might not be desired is if you
1209
- // bind something like 'A' cause you want to trigger an
1210
- // event when capital A is pressed caps lock will no longer
1211
- // trigger the event. shift+a will though.
1212
- if (!e.shiftKey) {
1213
- character = character.toLowerCase();
1214
- }
1215
-
1216
- return character;
1217
- }
1218
-
1219
- // for non keypress events the special maps are needed
1220
- if (_MAP[e.which]) {
1221
- return _MAP[e.which];
1222
- }
1223
-
1224
- if (_KEYCODE_MAP[e.which]) {
1225
- return _KEYCODE_MAP[e.which];
1226
- }
1227
-
1228
- // if it is not in the special map
1229
-
1230
- // with keydown and keyup events the character seems to always
1231
- // come in as an uppercase character whether you are pressing shift
1232
- // or not. we should make sure it is always lowercase for comparisons
1233
- return String.fromCharCode(e.which).toLowerCase();
1234
- }
1235
-
1236
- /**
1237
- * checks if two arrays are equal
1238
- *
1239
- * @param {Array} modifiers1
1240
- * @param {Array} modifiers2
1241
- * @returns {boolean}
1242
- */
1243
- function _modifiersMatch(modifiers1, modifiers2) {
1244
- return modifiers1.sort().join(',') === modifiers2.sort().join(',');
1245
- }
1246
-
1247
- /**
1248
- * takes a key event and figures out what the modifiers are
1249
- *
1250
- * @param {Event} e
1251
- * @returns {Array}
1252
- */
1253
- function _eventModifiers(e) {
1254
- var modifiers = [];
1255
-
1256
- if (e.shiftKey) {
1257
- modifiers.push('shift');
1258
- }
1259
-
1260
- if (e.altKey) {
1261
- modifiers.push('alt');
1262
- }
1263
-
1264
- if (e.ctrlKey) {
1265
- modifiers.push('ctrl');
1266
- }
1267
-
1268
- if (e.metaKey) {
1269
- modifiers.push('meta');
1270
- }
1271
-
1272
- return modifiers;
1273
- }
1274
-
1275
- /**
1276
- * prevents default for this event
1277
- *
1278
- * @param {Event} e
1279
- * @returns void
1280
- */
1281
- function _preventDefault(e) {
1282
- if (e.preventDefault) {
1283
- e.preventDefault();
1284
- return;
1285
- }
1286
-
1287
- e.returnValue = false;
1288
- }
1289
-
1290
- /**
1291
- * stops propogation for this event
1292
- *
1293
- * @param {Event} e
1294
- * @returns void
1295
- */
1296
- function _stopPropagation(e) {
1297
- if (e.stopPropagation) {
1298
- e.stopPropagation();
1299
- return;
1300
- }
1301
-
1302
- e.cancelBubble = true;
1303
- }
1304
-
1305
- /**
1306
- * determines if the keycode specified is a modifier key or not
1307
- *
1308
- * @param {string} key
1309
- * @returns {boolean}
1310
- */
1311
- function _isModifier(key) {
1312
- return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
1313
- }
1314
-
1315
- /**
1316
- * reverses the map lookup so that we can look for specific keys
1317
- * to see what can and can't use keypress
1318
- *
1319
- * @return {Object}
1320
- */
1321
- function _getReverseMap() {
1322
- if (!_REVERSE_MAP) {
1323
- _REVERSE_MAP = {};
1324
- for (var key in _MAP) {
1325
-
1326
- // pull out the numeric keypad from here cause keypress should
1327
- // be able to detect the keys from the character
1328
- if (key > 95 && key < 112) {
1329
- continue;
1330
- }
1331
-
1332
- if (_MAP.hasOwnProperty(key)) {
1333
- _REVERSE_MAP[_MAP[key]] = key;
1334
- }
1335
- }
1336
- }
1337
- return _REVERSE_MAP;
1338
- }
1339
-
1340
- /**
1341
- * picks the best action based on the key combination
1342
- *
1343
- * @param {string} key - character for key
1344
- * @param {Array} modifiers
1345
- * @param {string=} action passed in
1346
- */
1347
- function _pickBestAction(key, modifiers, action) {
1348
-
1349
- // if no action was picked in we should try to pick the one
1350
- // that we think would work best for this key
1351
- if (!action) {
1352
- action = _getReverseMap()[key] ? 'keydown' : 'keypress';
1353
- }
1354
-
1355
- // modifier keys don't work as expected with keypress,
1356
- // switch to keydown
1357
- if (action == 'keypress' && modifiers.length) {
1358
- action = 'keydown';
1359
- }
1360
-
1361
- return action;
1362
- }
1363
-
1364
- /**
1365
- * Converts from a string key combination to an array
1366
- *
1367
- * @param {string} combination like "command+shift+l"
1368
- * @return {Array}
1369
- */
1370
- function _keysFromString(combination) {
1371
- if (combination === '+') {
1372
- return ['+'];
1373
- }
1374
-
1375
- combination = combination.replace(/\+{2}/g, '+plus');
1376
- return combination.split('+');
1377
- }
1378
-
1379
- /**
1380
- * Gets info for a specific key combination
1381
- *
1382
- * @param {string} combination key combination ("command+s" or "a" or "*")
1383
- * @param {string=} action
1384
- * @returns {Object}
1385
- */
1386
- function _getKeyInfo(combination, action) {
1387
- var keys;
1388
- var key;
1389
- var i;
1390
- var modifiers = [];
1391
-
1392
- // take the keys from this pattern and figure out what the actual
1393
- // pattern is all about
1394
- keys = _keysFromString(combination);
1395
-
1396
- for (i = 0; i < keys.length; ++i) {
1397
- key = keys[i];
1398
-
1399
- // normalize key names
1400
- if (_SPECIAL_ALIASES[key]) {
1401
- key = _SPECIAL_ALIASES[key];
1402
- }
1403
-
1404
- // if this is not a keypress event then we should
1405
- // be smart about using shift keys
1406
- // this will only work for US keyboards however
1407
- if (action && action != 'keypress' && _SHIFT_MAP[key]) {
1408
- key = _SHIFT_MAP[key];
1409
- modifiers.push('shift');
1410
- }
1411
-
1412
- // if this key is a modifier then add it to the list of modifiers
1413
- if (_isModifier(key)) {
1414
- modifiers.push(key);
1415
- }
1416
- }
1417
-
1418
- // depending on what the key combination is
1419
- // we will try to pick the best event for it
1420
- action = _pickBestAction(key, modifiers, action);
1421
-
1422
- return {
1423
- key: key,
1424
- modifiers: modifiers,
1425
- action: action
1426
- };
1427
- }
1428
-
1429
- function _belongsTo(element, ancestor) {
1430
- if (element === null || element === document) {
1431
- return false;
1432
- }
1433
-
1434
- if (element === ancestor) {
1435
- return true;
1436
- }
1437
-
1438
- return _belongsTo(element.parentNode, ancestor);
1439
- }
1440
-
1441
- function Mousetrap(targetElement) {
1442
- var self = this;
1443
-
1444
- targetElement = targetElement || document;
1445
-
1446
- if (!(self instanceof Mousetrap)) {
1447
- return new Mousetrap(targetElement);
1448
- }
1449
-
1450
- /**
1451
- * element to attach key events to
1452
- *
1453
- * @type {Element}
1454
- */
1455
- self.target = targetElement;
1456
-
1457
- /**
1458
- * a list of all the callbacks setup via Mousetrap.bind()
1459
- *
1460
- * @type {Object}
1461
- */
1462
- self._callbacks = {};
1463
-
1464
- /**
1465
- * direct map of string combinations to callbacks used for trigger()
1466
- *
1467
- * @type {Object}
1468
- */
1469
- self._directMap = {};
1470
-
1471
- /**
1472
- * keeps track of what level each sequence is at since multiple
1473
- * sequences can start out with the same sequence
1474
- *
1475
- * @type {Object}
1476
- */
1477
- var _sequenceLevels = {};
1478
-
1479
- /**
1480
- * variable to store the setTimeout call
1481
- *
1482
- * @type {null|number}
1483
- */
1484
- var _resetTimer;
1485
-
1486
- /**
1487
- * temporary state where we will ignore the next keyup
1488
- *
1489
- * @type {boolean|string}
1490
- */
1491
- var _ignoreNextKeyup = false;
1492
-
1493
- /**
1494
- * temporary state where we will ignore the next keypress
1495
- *
1496
- * @type {boolean}
1497
- */
1498
- var _ignoreNextKeypress = false;
1499
-
1500
- /**
1501
- * are we currently inside of a sequence?
1502
- * type of action ("keyup" or "keydown" or "keypress") or false
1503
- *
1504
- * @type {boolean|string}
1505
- */
1506
- var _nextExpectedAction = false;
1507
-
1508
- /**
1509
- * resets all sequence counters except for the ones passed in
1510
- *
1511
- * @param {Object} doNotReset
1512
- * @returns void
1513
- */
1514
- function _resetSequences(doNotReset) {
1515
- doNotReset = doNotReset || {};
1516
-
1517
- var activeSequences = false,
1518
- key;
1519
-
1520
- for (key in _sequenceLevels) {
1521
- if (doNotReset[key]) {
1522
- activeSequences = true;
1523
- continue;
1524
- }
1525
- _sequenceLevels[key] = 0;
1526
- }
1527
-
1528
- if (!activeSequences) {
1529
- _nextExpectedAction = false;
1530
- }
1531
- }
1532
-
1533
- /**
1534
- * finds all callbacks that match based on the keycode, modifiers,
1535
- * and action
1536
- *
1537
- * @param {string} character
1538
- * @param {Array} modifiers
1539
- * @param {Event|Object} e
1540
- * @param {string=} sequenceName - name of the sequence we are looking for
1541
- * @param {string=} combination
1542
- * @param {number=} level
1543
- * @returns {Array}
1544
- */
1545
- function _getMatches(character, modifiers, e, sequenceName, combination, level) {
1546
- var i;
1547
- var callback;
1548
- var matches = [];
1549
- var action = e.type;
1550
-
1551
- // if there are no events related to this keycode
1552
- if (!self._callbacks[character]) {
1553
- return [];
1554
- }
1555
-
1556
- // if a modifier key is coming up on its own we should allow it
1557
- if (action == 'keyup' && _isModifier(character)) {
1558
- modifiers = [character];
1559
- }
1560
-
1561
- // loop through all callbacks for the key that was pressed
1562
- // and see if any of them match
1563
- for (i = 0; i < self._callbacks[character].length; ++i) {
1564
- callback = self._callbacks[character][i];
1565
-
1566
- // if a sequence name is not specified, but this is a sequence at
1567
- // the wrong level then move onto the next match
1568
- if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
1569
- continue;
1570
- }
1571
-
1572
- // if the action we are looking for doesn't match the action we got
1573
- // then we should keep going
1574
- if (action != callback.action) {
1575
- continue;
1576
- }
1577
-
1578
- // if this is a keypress event and the meta key and control key
1579
- // are not pressed that means that we need to only look at the
1580
- // character, otherwise check the modifiers as well
1581
- //
1582
- // chrome will not fire a keypress if meta or control is down
1583
- // safari will fire a keypress if meta or meta+shift is down
1584
- // firefox will fire a keypress if meta or control is down
1585
- if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
1586
-
1587
- // when you bind a combination or sequence a second time it
1588
- // should overwrite the first one. if a sequenceName or
1589
- // combination is specified in this call it does just that
1590
- //
1591
- // @todo make deleting its own method?
1592
- var deleteCombo = !sequenceName && callback.combo == combination;
1593
- var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
1594
- if (deleteCombo || deleteSequence) {
1595
- self._callbacks[character].splice(i, 1);
1596
- }
1597
-
1598
- matches.push(callback);
1599
- }
1600
- }
1601
-
1602
- return matches;
1603
- }
1604
-
1605
- /**
1606
- * actually calls the callback function
1607
- *
1608
- * if your callback function returns false this will use the jquery
1609
- * convention - prevent default and stop propogation on the event
1610
- *
1611
- * @param {Function} callback
1612
- * @param {Event} e
1613
- * @returns void
1614
- */
1615
- function _fireCallback(callback, e, combo, sequence) {
1616
-
1617
- // if this event should not happen stop here
1618
- if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
1619
- return;
1620
- }
1621
-
1622
- if (callback(e, combo) === false) {
1623
- _preventDefault(e);
1624
- _stopPropagation(e);
1625
- }
1626
- }
1627
-
1628
- /**
1629
- * handles a character key event
1630
- *
1631
- * @param {string} character
1632
- * @param {Array} modifiers
1633
- * @param {Event} e
1634
- * @returns void
1635
- */
1636
- self._handleKey = function(character, modifiers, e) {
1637
- var callbacks = _getMatches(character, modifiers, e);
1638
- var i;
1639
- var doNotReset = {};
1640
- var maxLevel = 0;
1641
- var processedSequenceCallback = false;
1642
-
1643
- // Calculate the maxLevel for sequences so we can only execute the longest callback sequence
1644
- for (i = 0; i < callbacks.length; ++i) {
1645
- if (callbacks[i].seq) {
1646
- maxLevel = Math.max(maxLevel, callbacks[i].level);
1647
- }
1648
- }
1649
-
1650
- // loop through matching callbacks for this key event
1651
- for (i = 0; i < callbacks.length; ++i) {
1652
-
1653
- // fire for all sequence callbacks
1654
- // this is because if for example you have multiple sequences
1655
- // bound such as "g i" and "g t" they both need to fire the
1656
- // callback for matching g cause otherwise you can only ever
1657
- // match the first one
1658
- if (callbacks[i].seq) {
1659
-
1660
- // only fire callbacks for the maxLevel to prevent
1661
- // subsequences from also firing
1662
- //
1663
- // for example 'a option b' should not cause 'option b' to fire
1664
- // even though 'option b' is part of the other sequence
1665
- //
1666
- // any sequences that do not match here will be discarded
1667
- // below by the _resetSequences call
1668
- if (callbacks[i].level != maxLevel) {
1669
- continue;
1670
- }
1671
-
1672
- processedSequenceCallback = true;
1673
-
1674
- // keep a list of which sequences were matches for later
1675
- doNotReset[callbacks[i].seq] = 1;
1676
- _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
1677
- continue;
1678
- }
1679
-
1680
- // if there were no sequence matches but we are still here
1681
- // that means this is a regular match so we should fire that
1682
- if (!processedSequenceCallback) {
1683
- _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
1684
- }
1685
- }
1686
-
1687
- // if the key you pressed matches the type of sequence without
1688
- // being a modifier (ie "keyup" or "keypress") then we should
1689
- // reset all sequences that were not matched by this event
1690
- //
1691
- // this is so, for example, if you have the sequence "h a t" and you
1692
- // type "h e a r t" it does not match. in this case the "e" will
1693
- // cause the sequence to reset
1694
- //
1695
- // modifier keys are ignored because you can have a sequence
1696
- // that contains modifiers such as "enter ctrl+space" and in most
1697
- // cases the modifier key will be pressed before the next key
1698
- //
1699
- // also if you have a sequence such as "ctrl+b a" then pressing the
1700
- // "b" key will trigger a "keypress" and a "keydown"
1701
- //
1702
- // the "keydown" is expected when there is a modifier, but the
1703
- // "keypress" ends up matching the _nextExpectedAction since it occurs
1704
- // after and that causes the sequence to reset
1705
- //
1706
- // we ignore keypresses in a sequence that directly follow a keydown
1707
- // for the same character
1708
- var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
1709
- if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
1710
- _resetSequences(doNotReset);
1711
- }
1712
-
1713
- _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
1714
- };
1715
-
1716
- /**
1717
- * handles a keydown event
1718
- *
1719
- * @param {Event} e
1720
- * @returns void
1721
- */
1722
- function _handleKeyEvent(e) {
1723
-
1724
- // normalize e.which for key events
1725
- // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
1726
- if (typeof e.which !== 'number') {
1727
- e.which = e.keyCode;
1728
- }
1729
-
1730
- var character = _characterFromEvent(e);
1731
-
1732
- // no character found then stop
1733
- if (!character) {
1734
- return;
1735
- }
1736
-
1737
- // need to use === for the character check because the character can be 0
1738
- if (e.type == 'keyup' && _ignoreNextKeyup === character) {
1739
- _ignoreNextKeyup = false;
1740
- return;
1741
- }
1742
-
1743
- self.handleKey(character, _eventModifiers(e), e);
1744
- }
1745
-
1746
- /**
1747
- * called to set a 1 second timeout on the specified sequence
1748
- *
1749
- * this is so after each key press in the sequence you have 1 second
1750
- * to press the next key before you have to start over
1751
- *
1752
- * @returns void
1753
- */
1754
- function _resetSequenceTimer() {
1755
- clearTimeout(_resetTimer);
1756
- _resetTimer = setTimeout(_resetSequences, 1000);
1757
- }
1758
-
1759
- /**
1760
- * binds a key sequence to an event
1761
- *
1762
- * @param {string} combo - combo specified in bind call
1763
- * @param {Array} keys
1764
- * @param {Function} callback
1765
- * @param {string=} action
1766
- * @returns void
1767
- */
1768
- function _bindSequence(combo, keys, callback, action) {
1769
-
1770
- // start off by adding a sequence level record for this combination
1771
- // and setting the level to 0
1772
- _sequenceLevels[combo] = 0;
1773
-
1774
- /**
1775
- * callback to increase the sequence level for this sequence and reset
1776
- * all other sequences that were active
1777
- *
1778
- * @param {string} nextAction
1779
- * @returns {Function}
1780
- */
1781
- function _increaseSequence(nextAction) {
1782
- return function() {
1783
- _nextExpectedAction = nextAction;
1784
- ++_sequenceLevels[combo];
1785
- _resetSequenceTimer();
1786
- };
1787
- }
1788
-
1789
- /**
1790
- * wraps the specified callback inside of another function in order
1791
- * to reset all sequence counters as soon as this sequence is done
1792
- *
1793
- * @param {Event} e
1794
- * @returns void
1795
- */
1796
- function _callbackAndReset(e) {
1797
- _fireCallback(callback, e, combo);
1798
-
1799
- // we should ignore the next key up if the action is key down
1800
- // or keypress. this is so if you finish a sequence and
1801
- // release the key the final key will not trigger a keyup
1802
- if (action !== 'keyup') {
1803
- _ignoreNextKeyup = _characterFromEvent(e);
1804
- }
1805
-
1806
- // weird race condition if a sequence ends with the key
1807
- // another sequence begins with
1808
- setTimeout(_resetSequences, 10);
1809
- }
1810
-
1811
- // loop through keys one at a time and bind the appropriate callback
1812
- // function. for any key leading up to the final one it should
1813
- // increase the sequence. after the final, it should reset all sequences
1814
- //
1815
- // if an action is specified in the original bind call then that will
1816
- // be used throughout. otherwise we will pass the action that the
1817
- // next key in the sequence should match. this allows a sequence
1818
- // to mix and match keypress and keydown events depending on which
1819
- // ones are better suited to the key provided
1820
- for (var i = 0; i < keys.length; ++i) {
1821
- var isFinal = i + 1 === keys.length;
1822
- var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
1823
- _bindSingle(keys[i], wrappedCallback, action, combo, i);
1824
- }
1825
- }
1826
-
1827
- /**
1828
- * binds a single keyboard combination
1829
- *
1830
- * @param {string} combination
1831
- * @param {Function} callback
1832
- * @param {string=} action
1833
- * @param {string=} sequenceName - name of sequence if part of sequence
1834
- * @param {number=} level - what part of the sequence the command is
1835
- * @returns void
1836
- */
1837
- function _bindSingle(combination, callback, action, sequenceName, level) {
1838
-
1839
- // store a direct mapped reference for use with Mousetrap.trigger
1840
- self._directMap[combination + ':' + action] = callback;
1841
-
1842
- // make sure multiple spaces in a row become a single space
1843
- combination = combination.replace(/\s+/g, ' ');
1844
-
1845
- var sequence = combination.split(' ');
1846
- var info;
1847
-
1848
- // if this pattern is a sequence of keys then run through this method
1849
- // to reprocess each pattern one key at a time
1850
- if (sequence.length > 1) {
1851
- _bindSequence(combination, sequence, callback, action);
1852
- return;
1853
- }
1854
-
1855
- info = _getKeyInfo(combination, action);
1856
-
1857
- // make sure to initialize array if this is the first time
1858
- // a callback is added for this key
1859
- self._callbacks[info.key] = self._callbacks[info.key] || [];
1860
-
1861
- // remove an existing match if there is one
1862
- _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
1863
-
1864
- // add this call back to the array
1865
- // if it is a sequence put it at the beginning
1866
- // if not put it at the end
1867
- //
1868
- // this is important because the way these are processed expects
1869
- // the sequence ones to come first
1870
- self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
1871
- callback: callback,
1872
- modifiers: info.modifiers,
1873
- action: info.action,
1874
- seq: sequenceName,
1875
- level: level,
1876
- combo: combination
1877
- });
1878
- }
1879
-
1880
- /**
1881
- * binds multiple combinations to the same callback
1882
- *
1883
- * @param {Array} combinations
1884
- * @param {Function} callback
1885
- * @param {string|undefined} action
1886
- * @returns void
1887
- */
1888
- self._bindMultiple = function(combinations, callback, action) {
1889
- for (var i = 0; i < combinations.length; ++i) {
1890
- _bindSingle(combinations[i], callback, action);
1891
- }
1892
- };
1893
-
1894
- // start!
1895
- _addEvent(targetElement, 'keypress', _handleKeyEvent);
1896
- _addEvent(targetElement, 'keydown', _handleKeyEvent);
1897
- _addEvent(targetElement, 'keyup', _handleKeyEvent);
1898
- }
1899
-
1900
- /**
1901
- * binds an event to mousetrap
1902
- *
1903
- * can be a single key, a combination of keys separated with +,
1904
- * an array of keys, or a sequence of keys separated by spaces
1905
- *
1906
- * be sure to list the modifier keys first to make sure that the
1907
- * correct key ends up getting bound (the last key in the pattern)
1908
- *
1909
- * @param {string|Array} keys
1910
- * @param {Function} callback
1911
- * @param {string=} action - 'keypress', 'keydown', or 'keyup'
1912
- * @returns void
1913
- */
1914
- Mousetrap.prototype.bind = function(keys, callback, action) {
1915
- var self = this;
1916
- keys = keys instanceof Array ? keys : [keys];
1917
- self._bindMultiple.call(self, keys, callback, action);
1918
- return self;
1919
- };
1920
-
1921
- /**
1922
- * unbinds an event to mousetrap
1923
- *
1924
- * the unbinding sets the callback function of the specified key combo
1925
- * to an empty function and deletes the corresponding key in the
1926
- * _directMap dict.
1927
- *
1928
- * TODO: actually remove this from the _callbacks dictionary instead
1929
- * of binding an empty function
1930
- *
1931
- * the keycombo+action has to be exactly the same as
1932
- * it was defined in the bind method
1933
- *
1934
- * @param {string|Array} keys
1935
- * @param {string} action
1936
- * @returns void
1937
- */
1938
- Mousetrap.prototype.unbind = function(keys, action) {
1939
- var self = this;
1940
- return self.bind.call(self, keys, function() {}, action);
1941
- };
1942
-
1943
- /**
1944
- * triggers an event that has already been bound
1945
- *
1946
- * @param {string} keys
1947
- * @param {string=} action
1948
- * @returns void
1949
- */
1950
- Mousetrap.prototype.trigger = function(keys, action) {
1951
- var self = this;
1952
- if (self._directMap[keys + ':' + action]) {
1953
- self._directMap[keys + ':' + action]({}, keys);
1954
- }
1955
- return self;
1956
- };
1957
-
1958
- /**
1959
- * resets the library back to its initial state. this is useful
1960
- * if you want to clear out the current keyboard shortcuts and bind
1961
- * new ones - for example if you switch to another page
1962
- *
1963
- * @returns void
1964
- */
1965
- Mousetrap.prototype.reset = function() {
1966
- var self = this;
1967
- self._callbacks = {};
1968
- self._directMap = {};
1969
- return self;
1970
- };
1971
-
1972
- /**
1973
- * should we stop this event before firing off callbacks
1974
- *
1975
- * @param {Event} e
1976
- * @param {Element} element
1977
- * @return {boolean}
1978
- */
1979
- Mousetrap.prototype.stopCallback = function(e, element) {
1980
- var self = this;
1981
-
1982
- // if the element has the class "mousetrap" then no need to stop
1983
- if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
1984
- return false;
1985
- }
1986
-
1987
- if (_belongsTo(element, self.target)) {
1988
- return false;
1989
- }
1990
-
1991
- // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host,
1992
- // not the initial event target in the shadow tree. Note that not all events cross the
1993
- // shadow boundary.
1994
- // For shadow trees with `mode: 'open'`, the initial event target is the first element in
1995
- // the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event
1996
- // target cannot be obtained.
1997
- if ('composedPath' in e && typeof e.composedPath === 'function') {
1998
- // For open shadow trees, update `element` so that the following check works.
1999
- var initialEventTarget = e.composedPath()[0];
2000
- if (initialEventTarget !== e.target) {
2001
- element = initialEventTarget;
2002
- }
2003
- }
2004
-
2005
- // stop for input, select, and textarea
2006
- return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
2007
- };
2008
-
2009
- /**
2010
- * exposes _handleKey publicly so it can be overwritten by extensions
2011
- */
2012
- Mousetrap.prototype.handleKey = function() {
2013
- var self = this;
2014
- return self._handleKey.apply(self, arguments);
2015
- };
2016
-
2017
- /**
2018
- * allow custom key mappings
2019
- */
2020
- Mousetrap.addKeycodes = function(object) {
2021
- for (var key in object) {
2022
- if (object.hasOwnProperty(key)) {
2023
- _MAP[key] = object[key];
2024
- }
2025
- }
2026
- _REVERSE_MAP = null;
2027
- };
2028
-
2029
- /**
2030
- * Init the global mousetrap functions
2031
- *
2032
- * This method is needed to allow the global mousetrap functions to work
2033
- * now that mousetrap is a constructor function.
2034
- */
2035
- Mousetrap.init = function() {
2036
- var documentMousetrap = Mousetrap(document);
2037
- for (var method in documentMousetrap) {
2038
- if (method.charAt(0) !== '_') {
2039
- Mousetrap[method] = (function(method) {
2040
- return function() {
2041
- return documentMousetrap[method].apply(documentMousetrap, arguments);
2042
- };
2043
- } (method));
2044
- }
2045
- }
2046
- };
2047
-
2048
- Mousetrap.init();
2049
-
2050
- // expose mousetrap to the global object
2051
- window.Mousetrap = Mousetrap;
2052
-
2053
- // expose as a common js module
2054
- if (module.exports) {
2055
- module.exports = Mousetrap;
2056
- }
2057
-
2058
- // expose mousetrap as an AMD module
2059
- if (typeof undefined$1 === 'function' && undefined$1.amd) {
2060
- undefined$1(function() {
2061
- return Mousetrap;
2062
- });
2063
- }
2064
- }) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null);
2065
- } (mousetrap));
2066
-
2067
- var Mousetrap$1 = mousetrap.exports;
2068
-
2069
- /**
2070
- * adds a bindGlobal method to Mousetrap that allows you to
2071
- * bind specific keyboard shortcuts that will still work
2072
- * inside a text input field
2073
- *
2074
- * usage:
2075
- * Mousetrap.bindGlobal('ctrl+s', _saveChanges);
2076
- */
2077
- /* global Mousetrap:true */
2078
- (function(Mousetrap) {
2079
- var _globalCallbacks = {};
2080
- var _originalStopCallback = Mousetrap.prototype.stopCallback;
2081
-
2082
- Mousetrap.prototype.stopCallback = function(e, element, combo, sequence) {
2083
- var self = this;
2084
-
2085
- if (self.paused) {
2086
- return true;
2087
- }
2088
-
2089
- if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
2090
- return false;
2091
- }
2092
-
2093
- return _originalStopCallback.call(self, e, element, combo);
2094
- };
2095
-
2096
- Mousetrap.prototype.bindGlobal = function(keys, callback, action) {
2097
- var self = this;
2098
- self.bind(keys, callback, action);
2099
-
2100
- if (keys instanceof Array) {
2101
- for (var i = 0; i < keys.length; i++) {
2102
- _globalCallbacks[keys[i]] = true;
2103
- }
2104
- return;
2105
- }
2106
-
2107
- _globalCallbacks[keys] = true;
2108
- };
2109
-
2110
- Mousetrap.prototype.unbindGlobal = function(keys, action) {
2111
- var self = this;
2112
- self.unbind(keys, action);
2113
-
2114
- if (keys instanceof Array) {
2115
- for (var i = 0; i < keys.length; i++) {
2116
- _globalCallbacks[keys[i]] = false;
2117
- }
2118
- return;
2119
- }
2120
-
2121
- _globalCallbacks[keys] = false;
2122
- };
2123
-
2124
- Mousetrap.init();
2125
- }) (Mousetrap);
2126
-
2127
- var MODES = {
2128
- "default": "default",
2129
- global: "global",
2130
- scoped: "scoped"
2131
- };
2132
- var DEFAULT_CONFIG = {
2133
- mode: MODES["default"],
2134
- unbindOnUnmount: true,
2135
- enabled: true
2136
- };
2137
- var MAC_TO_WINDOWS_KEYS_MAP = {
2138
- option: "alt",
2139
- command: "ctrl",
2140
- "return": "enter",
2141
- "delete": "backspace"
2142
- };
2143
- var OS = {
2144
- mac: "OS X",
2145
- windows: "Windows"
2146
- };
2147
- var KEY_NAMES = {
2148
- "delete": "delete",
2149
- backspace: "backspace"
2150
- };
2151
-
2152
- var platform$1 = {exports: {}};
2153
-
2154
- /*!
2155
- * Platform.js v1.3.6
2156
- * Copyright 2014-2020 Benjamin Tan
2157
- * Copyright 2011-2013 John-David Dalton
2158
- * Available under MIT license
2159
- */
2160
-
2161
- (function (module, exports) {
2162
- (function() {
2163
-
2164
- /** Used to determine if values are of the language type `Object`. */
2165
- var objectTypes = {
2166
- 'function': true,
2167
- 'object': true
2168
- };
2169
-
2170
- /** Used as a reference to the global object. */
2171
- var root = (objectTypes[typeof window] && window) || this;
2172
-
2173
- /** Detect free variable `exports`. */
2174
- var freeExports = exports;
2175
-
2176
- /** Detect free variable `module`. */
2177
- var freeModule = module && !module.nodeType && module;
2178
-
2179
- /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
2180
- var freeGlobal = freeExports && freeModule && typeof commonjsGlobal == 'object' && commonjsGlobal;
2181
- if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
2182
- root = freeGlobal;
2183
- }
2184
-
2185
- /**
2186
- * Used as the maximum length of an array-like object.
2187
- * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
2188
- * for more details.
2189
- */
2190
- var maxSafeInteger = Math.pow(2, 53) - 1;
2191
-
2192
- /** Regular expression to detect Opera. */
2193
- var reOpera = /\bOpera/;
2194
-
2195
- /** Used for native method references. */
2196
- var objectProto = Object.prototype;
2197
-
2198
- /** Used to check for own properties of an object. */
2199
- var hasOwnProperty = objectProto.hasOwnProperty;
2200
-
2201
- /** Used to resolve the internal `[[Class]]` of values. */
2202
- var toString = objectProto.toString;
2203
-
2204
- /*--------------------------------------------------------------------------*/
2205
-
2206
- /**
2207
- * Capitalizes a string value.
2208
- *
2209
- * @private
2210
- * @param {string} string The string to capitalize.
2211
- * @returns {string} The capitalized string.
2212
- */
2213
- function capitalize(string) {
2214
- string = String(string);
2215
- return string.charAt(0).toUpperCase() + string.slice(1);
2216
- }
2217
-
2218
- /**
2219
- * A utility function to clean up the OS name.
2220
- *
2221
- * @private
2222
- * @param {string} os The OS name to clean up.
2223
- * @param {string} [pattern] A `RegExp` pattern matching the OS name.
2224
- * @param {string} [label] A label for the OS.
2225
- */
2226
- function cleanupOS(os, pattern, label) {
2227
- // Platform tokens are defined at:
2228
- // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
2229
- // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
2230
- var data = {
2231
- '10.0': '10',
2232
- '6.4': '10 Technical Preview',
2233
- '6.3': '8.1',
2234
- '6.2': '8',
2235
- '6.1': 'Server 2008 R2 / 7',
2236
- '6.0': 'Server 2008 / Vista',
2237
- '5.2': 'Server 2003 / XP 64-bit',
2238
- '5.1': 'XP',
2239
- '5.01': '2000 SP1',
2240
- '5.0': '2000',
2241
- '4.0': 'NT',
2242
- '4.90': 'ME'
2243
- };
2244
- // Detect Windows version from platform tokens.
2245
- if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) &&
2246
- (data = data[/[\d.]+$/.exec(os)])) {
2247
- os = 'Windows ' + data;
2248
- }
2249
- // Correct character case and cleanup string.
2250
- os = String(os);
2251
-
2252
- if (pattern && label) {
2253
- os = os.replace(RegExp(pattern, 'i'), label);
2254
- }
2255
-
2256
- os = format(
2257
- os.replace(/ ce$/i, ' CE')
2258
- .replace(/\bhpw/i, 'web')
2259
- .replace(/\bMacintosh\b/, 'Mac OS')
2260
- .replace(/_PowerPC\b/i, ' OS')
2261
- .replace(/\b(OS X) [^ \d]+/i, '$1')
2262
- .replace(/\bMac (OS X)\b/, '$1')
2263
- .replace(/\/(\d)/, ' $1')
2264
- .replace(/_/g, '.')
2265
- .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
2266
- .replace(/\bx86\.64\b/gi, 'x86_64')
2267
- .replace(/\b(Windows Phone) OS\b/, '$1')
2268
- .replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
2269
- .split(' on ')[0]
2270
- );
2271
-
2272
- return os;
2273
- }
2274
-
2275
- /**
2276
- * An iteration utility for arrays and objects.
2277
- *
2278
- * @private
2279
- * @param {Array|Object} object The object to iterate over.
2280
- * @param {Function} callback The function called per iteration.
2281
- */
2282
- function each(object, callback) {
2283
- var index = -1,
2284
- length = object ? object.length : 0;
2285
-
2286
- if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
2287
- while (++index < length) {
2288
- callback(object[index], index, object);
2289
- }
2290
- } else {
2291
- forOwn(object, callback);
2292
- }
2293
- }
2294
-
2295
- /**
2296
- * Trim and conditionally capitalize string values.
2297
- *
2298
- * @private
2299
- * @param {string} string The string to format.
2300
- * @returns {string} The formatted string.
2301
- */
2302
- function format(string) {
2303
- string = trim(string);
2304
- return /^(?:webOS|i(?:OS|P))/.test(string)
2305
- ? string
2306
- : capitalize(string);
2307
- }
2308
-
2309
- /**
2310
- * Iterates over an object's own properties, executing the `callback` for each.
2311
- *
2312
- * @private
2313
- * @param {Object} object The object to iterate over.
2314
- * @param {Function} callback The function executed per own property.
2315
- */
2316
- function forOwn(object, callback) {
2317
- for (var key in object) {
2318
- if (hasOwnProperty.call(object, key)) {
2319
- callback(object[key], key, object);
2320
- }
2321
- }
2322
- }
2323
-
2324
- /**
2325
- * Gets the internal `[[Class]]` of a value.
2326
- *
2327
- * @private
2328
- * @param {*} value The value.
2329
- * @returns {string} The `[[Class]]`.
2330
- */
2331
- function getClassOf(value) {
2332
- return value == null
2333
- ? capitalize(value)
2334
- : toString.call(value).slice(8, -1);
2335
- }
2336
-
2337
- /**
2338
- * Host objects can return type values that are different from their actual
2339
- * data type. The objects we are concerned with usually return non-primitive
2340
- * types of "object", "function", or "unknown".
2341
- *
2342
- * @private
2343
- * @param {*} object The owner of the property.
2344
- * @param {string} property The property to check.
2345
- * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
2346
- */
2347
- function isHostType(object, property) {
2348
- var type = object != null ? typeof object[property] : 'number';
2349
- return !/^(?:boolean|number|string|undefined)$/.test(type) &&
2350
- (type == 'object' ? !!object[property] : true);
2351
- }
2352
-
2353
- /**
2354
- * Prepares a string for use in a `RegExp` by making hyphens and spaces optional.
2355
- *
2356
- * @private
2357
- * @param {string} string The string to qualify.
2358
- * @returns {string} The qualified string.
2359
- */
2360
- function qualify(string) {
2361
- return String(string).replace(/([ -])(?!$)/g, '$1?');
2362
- }
2363
-
2364
- /**
2365
- * A bare-bones `Array#reduce` like utility function.
2366
- *
2367
- * @private
2368
- * @param {Array} array The array to iterate over.
2369
- * @param {Function} callback The function called per iteration.
2370
- * @returns {*} The accumulated result.
2371
- */
2372
- function reduce(array, callback) {
2373
- var accumulator = null;
2374
- each(array, function(value, index) {
2375
- accumulator = callback(accumulator, value, index, array);
2376
- });
2377
- return accumulator;
2378
- }
2379
-
2380
- /**
2381
- * Removes leading and trailing whitespace from a string.
2382
- *
2383
- * @private
2384
- * @param {string} string The string to trim.
2385
- * @returns {string} The trimmed string.
2386
- */
2387
- function trim(string) {
2388
- return String(string).replace(/^ +| +$/g, '');
2389
- }
2390
-
2391
- /*--------------------------------------------------------------------------*/
2392
-
2393
- /**
2394
- * Creates a new platform object.
2395
- *
2396
- * @memberOf platform
2397
- * @param {Object|string} [ua=navigator.userAgent] The user agent string or
2398
- * context object.
2399
- * @returns {Object} A platform object.
2400
- */
2401
- function parse(ua) {
2402
-
2403
- /** The environment context object. */
2404
- var context = root;
2405
-
2406
- /** Used to flag when a custom context is provided. */
2407
- var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String';
2408
-
2409
- // Juggle arguments.
2410
- if (isCustomContext) {
2411
- context = ua;
2412
- ua = null;
2413
- }
2414
-
2415
- /** Browser navigator object. */
2416
- var nav = context.navigator || {};
2417
-
2418
- /** Browser user agent string. */
2419
- var userAgent = nav.userAgent || '';
2420
-
2421
- ua || (ua = userAgent);
2422
-
2423
- /** Used to detect if browser is like Chrome. */
2424
- var likeChrome = isCustomContext
2425
- ? !!nav.likeChrome
2426
- : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
2427
-
2428
- /** Internal `[[Class]]` value shortcuts. */
2429
- var objectClass = 'Object',
2430
- airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
2431
- enviroClass = isCustomContext ? objectClass : 'Environment',
2432
- javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java),
2433
- phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
2434
-
2435
- /** Detect Java environments. */
2436
- var java = /\bJava/.test(javaClass) && context.java;
2437
-
2438
- /** Detect Rhino. */
2439
- var rhino = java && getClassOf(context.environment) == enviroClass;
2440
-
2441
- /** A character to represent alpha. */
2442
- var alpha = java ? 'a' : '\u03b1';
2443
-
2444
- /** A character to represent beta. */
2445
- var beta = java ? 'b' : '\u03b2';
2446
-
2447
- /** Browser document object. */
2448
- var doc = context.document || {};
2449
-
2450
- /**
2451
- * Detect Opera browser (Presto-based).
2452
- * http://www.howtocreate.co.uk/operaStuff/operaObject.html
2453
- * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini
2454
- */
2455
- var opera = context.operamini || context.opera;
2456
-
2457
- /** Opera `[[Class]]`. */
2458
- var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera))
2459
- ? operaClass
2460
- : (opera = null);
2461
-
2462
- /*------------------------------------------------------------------------*/
2463
-
2464
- /** Temporary variable used over the script's lifetime. */
2465
- var data;
2466
-
2467
- /** The CPU architecture. */
2468
- var arch = ua;
2469
-
2470
- /** Platform description array. */
2471
- var description = [];
2472
-
2473
- /** Platform alpha/beta indicator. */
2474
- var prerelease = null;
2475
-
2476
- /** A flag to indicate that environment features should be used to resolve the platform. */
2477
- var useFeatures = ua == userAgent;
2478
-
2479
- /** The browser/environment version. */
2480
- var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
2481
-
2482
- /** A flag to indicate if the OS ends with "/ Version" */
2483
- var isSpecialCasedOS;
2484
-
2485
- /* Detectable layout engines (order is important). */
2486
- var layout = getLayout([
2487
- { 'label': 'EdgeHTML', 'pattern': 'Edge' },
2488
- 'Trident',
2489
- { 'label': 'WebKit', 'pattern': 'AppleWebKit' },
2490
- 'iCab',
2491
- 'Presto',
2492
- 'NetFront',
2493
- 'Tasman',
2494
- 'KHTML',
2495
- 'Gecko'
2496
- ]);
2497
-
2498
- /* Detectable browser names (order is important). */
2499
- var name = getName([
2500
- 'Adobe AIR',
2501
- 'Arora',
2502
- 'Avant Browser',
2503
- 'Breach',
2504
- 'Camino',
2505
- 'Electron',
2506
- 'Epiphany',
2507
- 'Fennec',
2508
- 'Flock',
2509
- 'Galeon',
2510
- 'GreenBrowser',
2511
- 'iCab',
2512
- 'Iceweasel',
2513
- 'K-Meleon',
2514
- 'Konqueror',
2515
- 'Lunascape',
2516
- 'Maxthon',
2517
- { 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' },
2518
- 'Midori',
2519
- 'Nook Browser',
2520
- 'PaleMoon',
2521
- 'PhantomJS',
2522
- 'Raven',
2523
- 'Rekonq',
2524
- 'RockMelt',
2525
- { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' },
2526
- 'SeaMonkey',
2527
- { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
2528
- 'Sleipnir',
2529
- 'SlimBrowser',
2530
- { 'label': 'SRWare Iron', 'pattern': 'Iron' },
2531
- 'Sunrise',
2532
- 'Swiftfox',
2533
- 'Vivaldi',
2534
- 'Waterfox',
2535
- 'WebPositive',
2536
- { 'label': 'Yandex Browser', 'pattern': 'YaBrowser' },
2537
- { 'label': 'UC Browser', 'pattern': 'UCBrowser' },
2538
- 'Opera Mini',
2539
- { 'label': 'Opera Mini', 'pattern': 'OPiOS' },
2540
- 'Opera',
2541
- { 'label': 'Opera', 'pattern': 'OPR' },
2542
- 'Chromium',
2543
- 'Chrome',
2544
- { 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' },
2545
- { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
2546
- { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
2547
- { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
2548
- { 'label': 'IE', 'pattern': 'IEMobile' },
2549
- { 'label': 'IE', 'pattern': 'MSIE' },
2550
- 'Safari'
2551
- ]);
2552
-
2553
- /* Detectable products (order is important). */
2554
- var product = getProduct([
2555
- { 'label': 'BlackBerry', 'pattern': 'BB10' },
2556
- 'BlackBerry',
2557
- { 'label': 'Galaxy S', 'pattern': 'GT-I9000' },
2558
- { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' },
2559
- { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' },
2560
- { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' },
2561
- { 'label': 'Galaxy S5', 'pattern': 'SM-G900' },
2562
- { 'label': 'Galaxy S6', 'pattern': 'SM-G920' },
2563
- { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' },
2564
- { 'label': 'Galaxy S7', 'pattern': 'SM-G930' },
2565
- { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' },
2566
- 'Google TV',
2567
- 'Lumia',
2568
- 'iPad',
2569
- 'iPod',
2570
- 'iPhone',
2571
- 'Kindle',
2572
- { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
2573
- 'Nexus',
2574
- 'Nook',
2575
- 'PlayBook',
2576
- 'PlayStation Vita',
2577
- 'PlayStation',
2578
- 'TouchPad',
2579
- 'Transformer',
2580
- { 'label': 'Wii U', 'pattern': 'WiiU' },
2581
- 'Wii',
2582
- 'Xbox One',
2583
- { 'label': 'Xbox 360', 'pattern': 'Xbox' },
2584
- 'Xoom'
2585
- ]);
2586
-
2587
- /* Detectable manufacturers. */
2588
- var manufacturer = getManufacturer({
2589
- 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
2590
- 'Alcatel': {},
2591
- 'Archos': {},
2592
- 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
2593
- 'Asus': { 'Transformer': 1 },
2594
- 'Barnes & Noble': { 'Nook': 1 },
2595
- 'BlackBerry': { 'PlayBook': 1 },
2596
- 'Google': { 'Google TV': 1, 'Nexus': 1 },
2597
- 'HP': { 'TouchPad': 1 },
2598
- 'HTC': {},
2599
- 'Huawei': {},
2600
- 'Lenovo': {},
2601
- 'LG': {},
2602
- 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
2603
- 'Motorola': { 'Xoom': 1 },
2604
- 'Nintendo': { 'Wii U': 1, 'Wii': 1 },
2605
- 'Nokia': { 'Lumia': 1 },
2606
- 'Oppo': {},
2607
- 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
2608
- 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 },
2609
- 'Xiaomi': { 'Mi': 1, 'Redmi': 1 }
2610
- });
2611
-
2612
- /* Detectable operating systems (order is important). */
2613
- var os = getOS([
2614
- 'Windows Phone',
2615
- 'KaiOS',
2616
- 'Android',
2617
- 'CentOS',
2618
- { 'label': 'Chrome OS', 'pattern': 'CrOS' },
2619
- 'Debian',
2620
- { 'label': 'DragonFly BSD', 'pattern': 'DragonFly' },
2621
- 'Fedora',
2622
- 'FreeBSD',
2623
- 'Gentoo',
2624
- 'Haiku',
2625
- 'Kubuntu',
2626
- 'Linux Mint',
2627
- 'OpenBSD',
2628
- 'Red Hat',
2629
- 'SuSE',
2630
- 'Ubuntu',
2631
- 'Xubuntu',
2632
- 'Cygwin',
2633
- 'Symbian OS',
2634
- 'hpwOS',
2635
- 'webOS ',
2636
- 'webOS',
2637
- 'Tablet OS',
2638
- 'Tizen',
2639
- 'Linux',
2640
- 'Mac OS X',
2641
- 'Macintosh',
2642
- 'Mac',
2643
- 'Windows 98;',
2644
- 'Windows '
2645
- ]);
2646
-
2647
- /*------------------------------------------------------------------------*/
2648
-
2649
- /**
2650
- * Picks the layout engine from an array of guesses.
2651
- *
2652
- * @private
2653
- * @param {Array} guesses An array of guesses.
2654
- * @returns {null|string} The detected layout engine.
2655
- */
2656
- function getLayout(guesses) {
2657
- return reduce(guesses, function(result, guess) {
2658
- return result || RegExp('\\b' + (
2659
- guess.pattern || qualify(guess)
2660
- ) + '\\b', 'i').exec(ua) && (guess.label || guess);
2661
- });
2662
- }
2663
-
2664
- /**
2665
- * Picks the manufacturer from an array of guesses.
2666
- *
2667
- * @private
2668
- * @param {Array} guesses An object of guesses.
2669
- * @returns {null|string} The detected manufacturer.
2670
- */
2671
- function getManufacturer(guesses) {
2672
- return reduce(guesses, function(result, value, key) {
2673
- // Lookup the manufacturer by product or scan the UA for the manufacturer.
2674
- return result || (
2675
- value[product] ||
2676
- value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] ||
2677
- RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)
2678
- ) && key;
2679
- });
2680
- }
2681
-
2682
- /**
2683
- * Picks the browser name from an array of guesses.
2684
- *
2685
- * @private
2686
- * @param {Array} guesses An array of guesses.
2687
- * @returns {null|string} The detected browser name.
2688
- */
2689
- function getName(guesses) {
2690
- return reduce(guesses, function(result, guess) {
2691
- return result || RegExp('\\b' + (
2692
- guess.pattern || qualify(guess)
2693
- ) + '\\b', 'i').exec(ua) && (guess.label || guess);
2694
- });
2695
- }
2696
-
2697
- /**
2698
- * Picks the OS name from an array of guesses.
2699
- *
2700
- * @private
2701
- * @param {Array} guesses An array of guesses.
2702
- * @returns {null|string} The detected OS name.
2703
- */
2704
- function getOS(guesses) {
2705
- return reduce(guesses, function(result, guess) {
2706
- var pattern = guess.pattern || qualify(guess);
2707
- if (!result && (result =
2708
- RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua)
2709
- )) {
2710
- result = cleanupOS(result, pattern, guess.label || guess);
2711
- }
2712
- return result;
2713
- });
2714
- }
2715
-
2716
- /**
2717
- * Picks the product name from an array of guesses.
2718
- *
2719
- * @private
2720
- * @param {Array} guesses An array of guesses.
2721
- * @returns {null|string} The detected product name.
2722
- */
2723
- function getProduct(guesses) {
2724
- return reduce(guesses, function(result, guess) {
2725
- var pattern = guess.pattern || qualify(guess);
2726
- if (!result && (result =
2727
- RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
2728
- RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
2729
- RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
2730
- )) {
2731
- // Split by forward slash and append product version if needed.
2732
- if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
2733
- result[0] += ' ' + result[1];
2734
- }
2735
- // Correct character case and cleanup string.
2736
- guess = guess.label || guess;
2737
- result = format(result[0]
2738
- .replace(RegExp(pattern, 'i'), guess)
2739
- .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
2740
- .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
2741
- }
2742
- return result;
2743
- });
2744
- }
2745
-
2746
- /**
2747
- * Resolves the version using an array of UA patterns.
2748
- *
2749
- * @private
2750
- * @param {Array} patterns An array of UA patterns.
2751
- * @returns {null|string} The detected version.
2752
- */
2753
- function getVersion(patterns) {
2754
- return reduce(patterns, function(result, pattern) {
2755
- return result || (RegExp(pattern +
2756
- '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
2757
- });
2758
- }
2759
-
2760
- /**
2761
- * Returns `platform.description` when the platform object is coerced to a string.
2762
- *
2763
- * @name toString
2764
- * @memberOf platform
2765
- * @returns {string} Returns `platform.description` if available, else an empty string.
2766
- */
2767
- function toStringPlatform() {
2768
- return this.description || '';
2769
- }
2770
-
2771
- /*------------------------------------------------------------------------*/
2772
-
2773
- // Convert layout to an array so we can add extra details.
2774
- layout && (layout = [layout]);
2775
-
2776
- // Detect Android products.
2777
- // Browsers on Android devices typically provide their product IDS after "Android;"
2778
- // up to "Build" or ") AppleWebKit".
2779
- // Example:
2780
- // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36
2781
- // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36"
2782
- if (/\bAndroid\b/.test(os) && !product &&
2783
- (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) {
2784
- product = trim(data[1])
2785
- // Replace any language codes (eg. "en-US").
2786
- .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '')
2787
- || null;
2788
- }
2789
- // Detect product names that contain their manufacturer's name.
2790
- if (manufacturer && !product) {
2791
- product = getProduct([manufacturer]);
2792
- } else if (manufacturer && product) {
2793
- product = product
2794
- .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ')
2795
- .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2');
2796
- }
2797
- // Clean up Google TV.
2798
- if ((data = /\bGoogle TV\b/.exec(product))) {
2799
- product = data[0];
2800
- }
2801
- // Detect simulators.
2802
- if (/\bSimulator\b/i.test(ua)) {
2803
- product = (product ? product + ' ' : '') + 'Simulator';
2804
- }
2805
- // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS.
2806
- if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
2807
- description.push('running in Turbo/Uncompressed mode');
2808
- }
2809
- // Detect IE Mobile 11.
2810
- if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
2811
- data = parse(ua.replace(/like iPhone OS/, ''));
2812
- manufacturer = data.manufacturer;
2813
- product = data.product;
2814
- }
2815
- // Detect iOS.
2816
- else if (/^iP/.test(product)) {
2817
- name || (name = 'Safari');
2818
- os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua))
2819
- ? ' ' + data[1].replace(/_/g, '.')
2820
- : '');
2821
- }
2822
- // Detect Kubuntu.
2823
- else if (name == 'Konqueror' && /^Linux\b/i.test(os)) {
2824
- os = 'Kubuntu';
2825
- }
2826
- // Detect Android browsers.
2827
- else if ((manufacturer && manufacturer != 'Google' &&
2828
- ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) ||
2829
- (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) {
2830
- name = 'Android Browser';
2831
- os = /\bAndroid\b/.test(os) ? os : 'Android';
2832
- }
2833
- // Detect Silk desktop/accelerated modes.
2834
- else if (name == 'Silk') {
2835
- if (!/\bMobi/i.test(ua)) {
2836
- os = 'Android';
2837
- description.unshift('desktop mode');
2838
- }
2839
- if (/Accelerated *= *true/i.test(ua)) {
2840
- description.unshift('accelerated');
2841
- }
2842
- }
2843
- // Detect UC Browser speed mode.
2844
- else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) {
2845
- description.push('speed mode');
2846
- }
2847
- // Detect PaleMoon identifying as Firefox.
2848
- else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
2849
- description.push('identifying as Firefox ' + data[1]);
2850
- }
2851
- // Detect Firefox OS and products running Firefox.
2852
- else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
2853
- os || (os = 'Firefox OS');
2854
- product || (product = data[1]);
2855
- }
2856
- // Detect false positives for Firefox/Safari.
2857
- else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
2858
- // Escape the `/` for Firefox 1.
2859
- if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
2860
- // Clear name of false positives.
2861
- name = null;
2862
- }
2863
- // Reassign a generic name.
2864
- if ((data = product || manufacturer || os) &&
2865
- (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
2866
- name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
2867
- }
2868
- }
2869
- // Add Chrome version to description for Electron.
2870
- else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
2871
- description.push('Chromium ' + data);
2872
- }
2873
- // Detect non-Opera (Presto-based) versions (order is important).
2874
- if (!version) {
2875
- version = getVersion([
2876
- '(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)',
2877
- 'Version',
2878
- qualify(name),
2879
- '(?:Firefox|Minefield|NetFront)'
2880
- ]);
2881
- }
2882
- // Detect stubborn layout engines.
2883
- if ((data =
2884
- layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' ||
2885
- /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') ||
2886
- /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' ||
2887
- !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') ||
2888
- layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront'
2889
- )) {
2890
- layout = [data];
2891
- }
2892
- // Detect Windows Phone 7 desktop mode.
2893
- if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
2894
- name += ' Mobile';
2895
- os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
2896
- description.unshift('desktop mode');
2897
- }
2898
- // Detect Windows Phone 8.x desktop mode.
2899
- else if (/\bWPDesktop\b/i.test(ua)) {
2900
- name = 'IE Mobile';
2901
- os = 'Windows Phone 8.x';
2902
- description.unshift('desktop mode');
2903
- version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
2904
- }
2905
- // Detect IE 11 identifying as other browsers.
2906
- else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
2907
- if (name) {
2908
- description.push('identifying as ' + name + (version ? ' ' + version : ''));
2909
- }
2910
- name = 'IE';
2911
- version = data[1];
2912
- }
2913
- // Leverage environment features.
2914
- if (useFeatures) {
2915
- // Detect server-side environments.
2916
- // Rhino has a global function while others have a global object.
2917
- if (isHostType(context, 'global')) {
2918
- if (java) {
2919
- data = java.lang.System;
2920
- arch = data.getProperty('os.arch');
2921
- os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
2922
- }
2923
- if (rhino) {
2924
- try {
2925
- version = context.require('ringo/engine').version.join('.');
2926
- name = 'RingoJS';
2927
- } catch(e) {
2928
- if ((data = context.system) && data.global.system == context.system) {
2929
- name = 'Narwhal';
2930
- os || (os = data[0].os || null);
2931
- }
2932
- }
2933
- if (!name) {
2934
- name = 'Rhino';
2935
- }
2936
- }
2937
- else if (
2938
- typeof context.process == 'object' && !context.process.browser &&
2939
- (data = context.process)
2940
- ) {
2941
- if (typeof data.versions == 'object') {
2942
- if (typeof data.versions.electron == 'string') {
2943
- description.push('Node ' + data.versions.node);
2944
- name = 'Electron';
2945
- version = data.versions.electron;
2946
- } else if (typeof data.versions.nw == 'string') {
2947
- description.push('Chromium ' + version, 'Node ' + data.versions.node);
2948
- name = 'NW.js';
2949
- version = data.versions.nw;
2950
- }
2951
- }
2952
- if (!name) {
2953
- name = 'Node.js';
2954
- arch = data.arch;
2955
- os = data.platform;
2956
- version = /[\d.]+/.exec(data.version);
2957
- version = version ? version[0] : null;
2958
- }
2959
- }
2960
- }
2961
- // Detect Adobe AIR.
2962
- else if (getClassOf((data = context.runtime)) == airRuntimeClass) {
2963
- name = 'Adobe AIR';
2964
- os = data.flash.system.Capabilities.os;
2965
- }
2966
- // Detect PhantomJS.
2967
- else if (getClassOf((data = context.phantom)) == phantomClass) {
2968
- name = 'PhantomJS';
2969
- version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
2970
- }
2971
- // Detect IE compatibility modes.
2972
- else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
2973
- // We're in compatibility mode when the Trident version + 4 doesn't
2974
- // equal the document mode.
2975
- version = [version, doc.documentMode];
2976
- if ((data = +data[1] + 4) != version[1]) {
2977
- description.push('IE ' + version[1] + ' mode');
2978
- layout && (layout[1] = '');
2979
- version[1] = data;
2980
- }
2981
- version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
2982
- }
2983
- // Detect IE 11 masking as other browsers.
2984
- else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
2985
- description.push('masking as ' + name + ' ' + version);
2986
- name = 'IE';
2987
- version = '11.0';
2988
- layout = ['Trident'];
2989
- os = 'Windows';
2990
- }
2991
- os = os && format(os);
2992
- }
2993
- // Detect prerelease phases.
2994
- if (version && (data =
2995
- /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
2996
- /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
2997
- /\bMinefield\b/i.test(ua) && 'a'
2998
- )) {
2999
- prerelease = /b/i.test(data) ? 'beta' : 'alpha';
3000
- version = version.replace(RegExp(data + '\\+?$'), '') +
3001
- (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
3002
- }
3003
- // Detect Firefox Mobile.
3004
- if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) {
3005
- name = 'Firefox Mobile';
3006
- }
3007
- // Obscure Maxthon's unreliable version.
3008
- else if (name == 'Maxthon' && version) {
3009
- version = version.replace(/\.[\d.]+/, '.x');
3010
- }
3011
- // Detect Xbox 360 and Xbox One.
3012
- else if (/\bXbox\b/i.test(product)) {
3013
- if (product == 'Xbox 360') {
3014
- os = null;
3015
- }
3016
- if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
3017
- description.unshift('mobile mode');
3018
- }
3019
- }
3020
- // Add mobile postfix.
3021
- else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) &&
3022
- (os == 'Windows CE' || /Mobi/i.test(ua))) {
3023
- name += ' Mobile';
3024
- }
3025
- // Detect IE platform preview.
3026
- else if (name == 'IE' && useFeatures) {
3027
- try {
3028
- if (context.external === null) {
3029
- description.unshift('platform preview');
3030
- }
3031
- } catch(e) {
3032
- description.unshift('embedded');
3033
- }
3034
- }
3035
- // Detect BlackBerry OS version.
3036
- // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
3037
- else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data =
3038
- (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
3039
- version
3040
- )) {
3041
- data = [data, /BB10/.test(ua)];
3042
- os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
3043
- version = null;
3044
- }
3045
- // Detect Opera identifying/masking itself as another browser.
3046
- // http://www.opera.com/support/kb/view/843/
3047
- else if (this != forOwn && product != 'Wii' && (
3048
- (useFeatures && opera) ||
3049
- (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) ||
3050
- (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) ||
3051
- (name == 'IE' && (
3052
- (os && !/^Win/.test(os) && version > 5.5) ||
3053
- /\bWindows XP\b/.test(os) && version > 8 ||
3054
- version == 8 && !/\bTrident\b/.test(ua)
3055
- ))
3056
- ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
3057
- // When "identifying", the UA contains both Opera and the other browser's name.
3058
- data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
3059
- if (reOpera.test(name)) {
3060
- if (/\bIE\b/.test(data) && os == 'Mac OS') {
3061
- os = null;
3062
- }
3063
- data = 'identify' + data;
3064
- }
3065
- // When "masking", the UA contains only the other browser's name.
3066
- else {
3067
- data = 'mask' + data;
3068
- if (operaClass) {
3069
- name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
3070
- } else {
3071
- name = 'Opera';
3072
- }
3073
- if (/\bIE\b/.test(data)) {
3074
- os = null;
3075
- }
3076
- if (!useFeatures) {
3077
- version = null;
3078
- }
3079
- }
3080
- layout = ['Presto'];
3081
- description.push(data);
3082
- }
3083
- // Detect WebKit Nightly and approximate Chrome/Safari versions.
3084
- if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
3085
- // Correct build number for numeric comparison.
3086
- // (e.g. "532.5" becomes "532.05")
3087
- data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
3088
- // Nightly builds are postfixed with a "+".
3089
- if (name == 'Safari' && data[1].slice(-1) == '+') {
3090
- name = 'WebKit Nightly';
3091
- prerelease = 'alpha';
3092
- version = data[1].slice(0, -1);
3093
- }
3094
- // Clear incorrect browser versions.
3095
- else if (version == data[1] ||
3096
- version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
3097
- version = null;
3098
- }
3099
- // Use the full Chrome version when available.
3100
- data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1];
3101
- // Detect Blink layout engine.
3102
- if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
3103
- layout = ['Blink'];
3104
- }
3105
- // Detect JavaScriptCore.
3106
- // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
3107
- if (!useFeatures || (!likeChrome && !data[1])) {
3108
- layout && (layout[1] = 'like Safari');
3109
- data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12');
3110
- } else {
3111
- layout && (layout[1] = 'like Chrome');
3112
- data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28');
3113
- }
3114
- // Add the postfix of ".x" or "+" for approximate versions.
3115
- layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
3116
- // Obscure version for some Safari 1-2 releases.
3117
- if (name == 'Safari' && (!version || parseInt(version) > 45)) {
3118
- version = data;
3119
- } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) {
3120
- description.unshift('headless');
3121
- }
3122
- }
3123
- // Detect Opera desktop modes.
3124
- if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
3125
- name += ' ';
3126
- description.unshift('desktop mode');
3127
- if (data == 'zvav') {
3128
- name += 'Mini';
3129
- version = null;
3130
- } else {
3131
- name += 'Mobile';
3132
- }
3133
- os = os.replace(RegExp(' *' + data + '$'), '');
3134
- }
3135
- // Detect Chrome desktop mode.
3136
- else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
3137
- description.unshift('desktop mode');
3138
- name = 'Chrome Mobile';
3139
- version = null;
3140
-
3141
- if (/\bOS X\b/.test(os)) {
3142
- manufacturer = 'Apple';
3143
- os = 'iOS 4.3+';
3144
- } else {
3145
- os = null;
3146
- }
3147
- }
3148
- // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number.
3149
- else if (/\bSRWare Iron\b/.test(name) && !version) {
3150
- version = getVersion('Chrome');
3151
- }
3152
- // Strip incorrect OS versions.
3153
- if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
3154
- ua.indexOf('/' + data + '-') > -1) {
3155
- os = trim(os.replace(data, ''));
3156
- }
3157
- // Ensure OS does not include the browser name.
3158
- if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
3159
- os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
3160
- }
3161
- // Add layout engine.
3162
- if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
3163
- /Browser|Lunascape|Maxthon/.test(name) ||
3164
- name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
3165
- /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) {
3166
- // Don't add layout details to description if they are falsey.
3167
- (data = layout[layout.length - 1]) && description.push(data);
3168
- }
3169
- // Combine contextual information.
3170
- if (description.length) {
3171
- description = ['(' + description.join('; ') + ')'];
3172
- }
3173
- // Append manufacturer to description.
3174
- if (manufacturer && product && product.indexOf(manufacturer) < 0) {
3175
- description.push('on ' + manufacturer);
3176
- }
3177
- // Append product to description.
3178
- if (product) {
3179
- description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
3180
- }
3181
- // Parse the OS into an object.
3182
- if (os) {
3183
- data = / ([\d.+]+)$/.exec(os);
3184
- isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
3185
- os = {
3186
- 'architecture': 32,
3187
- 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
3188
- 'version': data ? data[1] : null,
3189
- 'toString': function() {
3190
- var version = this.version;
3191
- return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
3192
- }
3193
- };
3194
- }
3195
- // Add browser/OS architecture.
3196
- if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
3197
- if (os) {
3198
- os.architecture = 64;
3199
- os.family = os.family.replace(RegExp(' *' + data), '');
3200
- }
3201
- if (
3202
- name && (/\bWOW64\b/i.test(ua) ||
3203
- (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua)))
3204
- ) {
3205
- description.unshift('32-bit');
3206
- }
3207
- }
3208
- // Chrome 39 and above on OS X is always 64-bit.
3209
- else if (
3210
- os && /^OS X/.test(os.family) &&
3211
- name == 'Chrome' && parseFloat(version) >= 39
3212
- ) {
3213
- os.architecture = 64;
3214
- }
3215
-
3216
- ua || (ua = null);
3217
-
3218
- /*------------------------------------------------------------------------*/
3219
-
3220
- /**
3221
- * The platform object.
3222
- *
3223
- * @name platform
3224
- * @type Object
3225
- */
3226
- var platform = {};
3227
-
3228
- /**
3229
- * The platform description.
3230
- *
3231
- * @memberOf platform
3232
- * @type string|null
3233
- */
3234
- platform.description = ua;
3235
-
3236
- /**
3237
- * The name of the browser's layout engine.
3238
- *
3239
- * The list of common layout engines include:
3240
- * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit"
3241
- *
3242
- * @memberOf platform
3243
- * @type string|null
3244
- */
3245
- platform.layout = layout && layout[0];
3246
-
3247
- /**
3248
- * The name of the product's manufacturer.
3249
- *
3250
- * The list of manufacturers include:
3251
- * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry",
3252
- * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo",
3253
- * "Nokia", "Samsung" and "Sony"
3254
- *
3255
- * @memberOf platform
3256
- * @type string|null
3257
- */
3258
- platform.manufacturer = manufacturer;
3259
-
3260
- /**
3261
- * The name of the browser/environment.
3262
- *
3263
- * The list of common browser names include:
3264
- * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE",
3265
- * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk",
3266
- * "Opera Mini" and "Opera"
3267
- *
3268
- * Mobile versions of some browsers have "Mobile" appended to their name:
3269
- * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile"
3270
- *
3271
- * @memberOf platform
3272
- * @type string|null
3273
- */
3274
- platform.name = name;
3275
-
3276
- /**
3277
- * The alpha/beta release indicator.
3278
- *
3279
- * @memberOf platform
3280
- * @type string|null
3281
- */
3282
- platform.prerelease = prerelease;
3283
-
3284
- /**
3285
- * The name of the product hosting the browser.
3286
- *
3287
- * The list of common products include:
3288
- *
3289
- * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle",
3290
- * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer"
3291
- *
3292
- * @memberOf platform
3293
- * @type string|null
3294
- */
3295
- platform.product = product;
3296
-
3297
- /**
3298
- * The browser's user agent string.
3299
- *
3300
- * @memberOf platform
3301
- * @type string|null
3302
- */
3303
- platform.ua = ua;
3304
-
3305
- /**
3306
- * The browser/environment version.
3307
- *
3308
- * @memberOf platform
3309
- * @type string|null
3310
- */
3311
- platform.version = name && version;
3312
-
3313
- /**
3314
- * The name of the operating system.
3315
- *
3316
- * @memberOf platform
3317
- * @type Object
3318
- */
3319
- platform.os = os || {
3320
-
3321
- /**
3322
- * The CPU architecture the OS is built for.
3323
- *
3324
- * @memberOf platform.os
3325
- * @type number|null
3326
- */
3327
- 'architecture': null,
3328
-
3329
- /**
3330
- * The family of the OS.
3331
- *
3332
- * Common values include:
3333
- * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
3334
- * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
3335
- * "SuSE", "Android", "iOS" and "Windows Phone"
3336
- *
3337
- * @memberOf platform.os
3338
- * @type string|null
3339
- */
3340
- 'family': null,
3341
-
3342
- /**
3343
- * The version of the OS.
3344
- *
3345
- * @memberOf platform.os
3346
- * @type string|null
3347
- */
3348
- 'version': null,
3349
-
3350
- /**
3351
- * Returns the OS string.
3352
- *
3353
- * @memberOf platform.os
3354
- * @returns {string} The OS string.
3355
- */
3356
- 'toString': function() { return 'null'; }
3357
- };
3358
-
3359
- platform.parse = parse;
3360
- platform.toString = toStringPlatform;
3361
-
3362
- if (platform.version) {
3363
- description.unshift(version);
3364
- }
3365
- if (platform.name) {
3366
- description.unshift(name);
3367
- }
3368
- if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
3369
- description.push(product ? '(' + os + ')' : 'on ' + os);
3370
- }
3371
- if (description.length) {
3372
- platform.description = description.join(' ');
3373
- }
3374
- return platform;
3375
- }
3376
-
3377
- /*--------------------------------------------------------------------------*/
3378
-
3379
- // Export platform.
3380
- var platform = parse();
3381
-
3382
- // Some AMD build optimizers, like r.js, check for condition patterns like the following:
3383
- if (freeExports && freeModule) {
3384
- // Export for CommonJS support.
3385
- forOwn(platform, function(value, key) {
3386
- freeExports[key] = value;
3387
- });
3388
- }
3389
- else {
3390
- // Export to the global object.
3391
- root.platform = platform;
3392
- }
3393
- }.call(commonjsGlobal));
3394
- } (platform$1, platform$1.exports));
3395
-
3396
- var platform = platform$1.exports;
3397
-
3398
- var isMultipleHotkey = function isMultipleHotkey(hotkey) {
3399
- return Array.isArray(hotkey);
3400
- };
3401
- var replaceKeys = function replaceKeys(hotkey, keyName, replaceWith) {
3402
- return isMultipleHotkey(hotkey) ? hotkey.map(function (item) {
3403
- return item.replaceAll(keyName, replaceWith);
3404
- }) : hotkey.replaceAll(keyName, replaceWith);
3405
- };
3406
- var convertHotKeyToWindows = function convertHotKeyToWindows(hotkey) {
3407
- ramda.toPairs(MAC_TO_WINDOWS_KEYS_MAP).forEach(function (_ref) {
3408
- var _ref2 = _slicedToArray(_ref, 2),
3409
- macKey = _ref2[0],
3410
- windowsKey = _ref2[1];
3411
- hotkey = replaceKeys(hotkey, macKey, windowsKey);
3412
- });
3413
- return hotkey;
3414
- };
3415
- var convertHotkeyToUsersPlatform = function convertHotkeyToUsersPlatform(hotkey) {
3416
- var _platformInfo$os, _platformInfo$os$fami;
3417
- var platformInfo = platform.parse(navigator.userAgent);
3418
- var isOSX = (_platformInfo$os = platformInfo.os) === null || _platformInfo$os === void 0 ? void 0 : (_platformInfo$os$fami = _platformInfo$os.family) === null || _platformInfo$os$fami === void 0 ? void 0 : _platformInfo$os$fami.includes(OS.mac);
3419
- if (isOSX) return replaceKeys(hotkey, KEY_NAMES["delete"], KEY_NAMES.backspace);
3420
- return convertHotKeyToWindows(hotkey);
3421
- };
3422
-
3423
- var useHotKeys = function useHotKeys(hotkey, handler, userConfig) {
3424
- var ref = React.useRef(null);
3425
- var convertedHotkey = convertHotkeyToUsersPlatform(hotkey);
3426
- var config = ramda.mergeLeft(userConfig, DEFAULT_CONFIG);
3427
- if (!handler) {
3428
- throw new Error("You must provide a handler function to useHotKeys");
3429
- }
3430
- React.useEffect(function () {
3431
- if (!config.enabled) return undefined;
3432
- var mousetrapInstance = bindHotKey({
3433
- mode: config.mode,
3434
- hotkey: convertedHotkey,
3435
- handler: handler,
3436
- ref: ref
3437
- });
3438
- return function () {
3439
- unBindHotKey({
3440
- mousetrapInstance: mousetrapInstance,
3441
- mode: config.mode,
3442
- hotkey: convertedHotkey
3443
- });
3444
- };
3445
- }, [handler, config.mode, convertedHotkey, config]);
3446
- return config.mode === MODES.scoped ? ref : null;
3447
- };
3448
- var bindHotKey = function bindHotKey(_ref) {
3449
- var mode = _ref.mode,
3450
- hotkey = _ref.hotkey,
3451
- handler = _ref.handler,
3452
- ref = _ref.ref;
3453
- var mousetrapInstance;
3454
- switch (mode) {
3455
- case MODES.global:
3456
- Mousetrap$1.bindGlobal(hotkey, handler);
3457
- break;
3458
- case MODES.scoped:
3459
- mousetrapInstance = Mousetrap$1(ref.current).bind(hotkey, handler);
3460
- break;
3461
- default:
3462
- mousetrapInstance = Mousetrap$1.bind(hotkey, handler);
3463
- }
3464
- return mousetrapInstance;
3465
- };
3466
- var unBindHotKey = function unBindHotKey(_ref2) {
3467
- var mousetrapInstance = _ref2.mousetrapInstance,
3468
- mode = _ref2.mode,
3469
- hotkey = _ref2.hotkey;
3470
- return mode === MODES.global ? Mousetrap$1.unbindGlobal(hotkey) : mousetrapInstance === null || mousetrapInstance === void 0 ? void 0 : mousetrapInstance.unbind(hotkey);
3471
- };
3472
-
3473
- var useForceUpdate = function useForceUpdate() {
3474
- // eslint-disable-next-line react/hook-use-state
3475
- var _useState = React.useState(0),
3476
- _useState2 = _slicedToArray(_useState, 2),
3477
- setValue = _useState2[1];
3478
- return function () {
3479
- return setValue(function (value) {
3480
- return value + 1;
3481
- });
3482
- };
3483
- };
3484
-
3485
- var useIsElementVisibleInDom = function useIsElementVisibleInDom(target) {
3486
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
3487
- var _useState = React.useState(false),
3488
- _useState2 = _slicedToArray(_useState, 2),
3489
- isIntersecting = _useState2[0],
3490
- setIsIntersecting = _useState2[1];
3491
- var forceUpdate = useForceUpdate();
3492
- React.useEffect(function () {
3493
- if (!target) return forceUpdate();
3494
- var observer = new IntersectionObserver(function (_ref) {
3495
- var _ref2 = _slicedToArray(_ref, 1),
3496
- entry = _ref2[0];
3497
- return setIsIntersecting(entry.isIntersecting);
3498
- }, options);
3499
- observer.observe(target);
3500
- return function () {
3501
- return observer.unobserve(target);
3502
- };
3503
- }, [target, options]);
3504
- return isIntersecting;
3505
- };
3506
-
3507
- function shallow(objA, objB) {
3508
- if (Object.is(objA, objB)) {
3509
- return true;
3510
- }
3511
- if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
3512
- return false;
3513
- }
3514
- if (objA instanceof Map && objB instanceof Map) {
3515
- if (objA.size !== objB.size)
3516
- return false;
3517
- for (const [key, value] of objA) {
3518
- if (!Object.is(value, objB.get(key))) {
3519
- return false;
3520
- }
3521
- }
3522
- return true;
3523
- }
3524
- if (objA instanceof Set && objB instanceof Set) {
3525
- if (objA.size !== objB.size)
3526
- return false;
3527
- for (const value of objA) {
3528
- if (!objB.has(value)) {
3529
- return false;
3530
- }
3531
- }
3532
- return true;
3533
- }
3534
- const keysA = Object.keys(objA);
3535
- if (keysA.length !== Object.keys(objB).length) {
3536
- return false;
3537
- }
3538
- for (let i = 0; i < keysA.length; i++) {
3539
- if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {
3540
- return false;
3541
- }
3542
- }
3543
- return true;
3544
- }
3545
-
3546
- var useKeyboardShortcutsStore = create$1(function (set) {
3547
- return {
3548
- isOpen: false,
3549
- setIsOpen: function setIsOpen(arg) {
3550
- if (typeof arg === "function") {
3551
- set(function (state) {
3552
- return {
3553
- isOpen: arg(state.isOpen)
3554
- };
3555
- });
3556
- } else {
3557
- set({
3558
- isOpen: arg
3559
- });
3560
- }
3561
- }
3562
- };
3563
- });
3564
- var useKeyboardShortcutsPaneState = function useKeyboardShortcutsPaneState() {
3565
- return useKeyboardShortcutsStore(function (_ref) {
3566
- var isOpen = _ref.isOpen,
3567
- setIsOpen = _ref.setIsOpen;
3568
- return [isOpen, setIsOpen];
3569
- }, shallow);
3570
- };
3571
-
3572
- var getStorageValue = function getStorageValue(key, defaultValue) {
3573
- try {
3574
- var storedValue = localStorage.getItem(key);
3575
- return storedValue ? JSON.parse(storedValue) : defaultValue;
3576
- } catch (error) {
3577
- logger.error(error);
3578
- return defaultValue;
3579
- }
3580
- };
3581
- var useLocalStorage = function useLocalStorage(key, defaultValue) {
3582
- var _useState = React.useState(function () {
3583
- return getStorageValue(key, defaultValue);
3584
- }),
3585
- _useState2 = _slicedToArray(_useState, 2),
3586
- storedValue = _useState2[0],
3587
- setStoredValue = _useState2[1];
3588
- var setValue = function setValue(value) {
3589
- if (ramda.isNil(value)) {
3590
- localStorage.removeItem(key);
3591
- } else {
3592
- localStorage.setItem(key, JSON.stringify(value));
3593
- }
3594
- setStoredValue(value);
3595
- };
3596
- return [storedValue, setValue];
3597
- };
3598
-
3599
- var _excluded = ["keysToInvalidate"],
3600
- _excluded2 = ["onSuccess"];
3601
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3602
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3603
- var useMutationWithInvalidation = function useMutationWithInvalidation(mutationFn, _ref) {
3604
- var keysToInvalidate = _ref.keysToInvalidate,
3605
- options = _objectWithoutProperties(_ref, _excluded);
3606
- var queryClient = reactQuery.useQueryClient();
3607
- var _onSuccess = options.onSuccess,
3608
- otherOptions = _objectWithoutProperties(options, _excluded2);
3609
- return reactQuery.useMutation(mutationFn, _objectSpread$1({
3610
- onSuccess: function onSuccess(data, variables, context) {
3611
- keysToInvalidate.forEach(function (key) {
3612
- var keyToInvalidate = typeof key === "function" ? key(data, variables, context) : key;
3613
- queryClient.invalidateQueries(keyToInvalidate);
3614
- });
3615
- _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess(data, variables, context);
3616
- }
3617
- }, otherOptions));
3618
- };
3619
-
3620
- var useOnClickOutside = function useOnClickOutside(ref, handler) {
3621
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
3622
- _ref$enabled = _ref.enabled,
3623
- enabled = _ref$enabled === void 0 ? true : _ref$enabled;
3624
- React.useEffect(function () {
3625
- var listener = function listener(event) {
3626
- // Do nothing if clicking ref's element or descendent elements
3627
- if (!ref.current || ref.current.contains(event.target)) {
3628
- return;
3629
- }
3630
- handler(event);
3631
- };
3632
- if (enabled) {
3633
- document.addEventListener("mousedown", listener);
3634
- document.addEventListener("touchstart", listener);
3635
- }
3636
- return function () {
3637
- document.removeEventListener("mousedown", listener);
3638
- document.removeEventListener("touchstart", listener);
3639
- };
3640
- }, [handler, enabled]);
3641
- };
3642
-
3643
- var usePrevious = function usePrevious(value) {
3644
- var ref = React.useRef(value);
3645
- React.useEffect(function () {
3646
- ref.current = value;
3647
- }, [value]);
3648
- return ref.current;
3649
- };
3650
-
3651
- 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; }
3652
- 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; }
3653
- var useQueryParams = function useQueryParams() {
3654
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3655
- var location = reactRouterDom.useLocation();
3656
- return qs.parse(location.search, _objectSpread({
3657
- ignoreQueryPrefix: true
3658
- }, options));
3659
- };
3660
-
3661
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
3662
- try {
3663
- var info = gen[key](arg);
3664
- var value = info.value;
3665
- } catch (error) {
3666
- reject(error);
3667
- return;
3668
- }
3669
- if (info.done) {
3670
- resolve(value);
3671
- } else {
3672
- Promise.resolve(value).then(_next, _throw);
3673
- }
3674
- }
3675
- function _asyncToGenerator(fn) {
3676
- return function () {
3677
- var self = this,
3678
- args = arguments;
3679
- return new Promise(function (resolve, reject) {
3680
- var gen = fn.apply(self, args);
3681
- function _next(value) {
3682
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
3683
- }
3684
- function _throw(err) {
3685
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
3686
- }
3687
- _next(undefined);
3688
- });
3689
- };
3690
- }
3691
-
3692
- var regeneratorRuntime$1 = {exports: {}};
3693
-
3694
- var _typeof = {exports: {}};
3695
-
3696
- (function (module) {
3697
- function _typeof(obj) {
3698
- "@babel/helpers - typeof";
3699
-
3700
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
3701
- return typeof obj;
3702
- } : function (obj) {
3703
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
3704
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
3705
- }
3706
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
3707
- } (_typeof));
3708
-
3709
- (function (module) {
3710
- var _typeof$1 = _typeof.exports["default"];
3711
- function _regeneratorRuntime() {
3712
- module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
3713
- return exports;
3714
- }, module.exports.__esModule = true, module.exports["default"] = module.exports;
3715
- var exports = {},
3716
- Op = Object.prototype,
3717
- hasOwn = Op.hasOwnProperty,
3718
- defineProperty = Object.defineProperty || function (obj, key, desc) {
3719
- obj[key] = desc.value;
3720
- },
3721
- $Symbol = "function" == typeof Symbol ? Symbol : {},
3722
- iteratorSymbol = $Symbol.iterator || "@@iterator",
3723
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
3724
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
3725
- function define(obj, key, value) {
3726
- return Object.defineProperty(obj, key, {
3727
- value: value,
3728
- enumerable: !0,
3729
- configurable: !0,
3730
- writable: !0
3731
- }), obj[key];
3732
- }
3733
- try {
3734
- define({}, "");
3735
- } catch (err) {
3736
- define = function define(obj, key, value) {
3737
- return obj[key] = value;
3738
- };
3739
- }
3740
- function wrap(innerFn, outerFn, self, tryLocsList) {
3741
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
3742
- generator = Object.create(protoGenerator.prototype),
3743
- context = new Context(tryLocsList || []);
3744
- return defineProperty(generator, "_invoke", {
3745
- value: makeInvokeMethod(innerFn, self, context)
3746
- }), generator;
3747
- }
3748
- function tryCatch(fn, obj, arg) {
3749
- try {
3750
- return {
3751
- type: "normal",
3752
- arg: fn.call(obj, arg)
3753
- };
3754
- } catch (err) {
3755
- return {
3756
- type: "throw",
3757
- arg: err
3758
- };
3759
- }
3760
- }
3761
- exports.wrap = wrap;
3762
- var ContinueSentinel = {};
3763
- function Generator() {}
3764
- function GeneratorFunction() {}
3765
- function GeneratorFunctionPrototype() {}
3766
- var IteratorPrototype = {};
3767
- define(IteratorPrototype, iteratorSymbol, function () {
3768
- return this;
3769
- });
3770
- var getProto = Object.getPrototypeOf,
3771
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
3772
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
3773
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
3774
- function defineIteratorMethods(prototype) {
3775
- ["next", "throw", "return"].forEach(function (method) {
3776
- define(prototype, method, function (arg) {
3777
- return this._invoke(method, arg);
3778
- });
3779
- });
3780
- }
3781
- function AsyncIterator(generator, PromiseImpl) {
3782
- function invoke(method, arg, resolve, reject) {
3783
- var record = tryCatch(generator[method], generator, arg);
3784
- if ("throw" !== record.type) {
3785
- var result = record.arg,
3786
- value = result.value;
3787
- return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
3788
- invoke("next", value, resolve, reject);
3789
- }, function (err) {
3790
- invoke("throw", err, resolve, reject);
3791
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
3792
- result.value = unwrapped, resolve(result);
3793
- }, function (error) {
3794
- return invoke("throw", error, resolve, reject);
3795
- });
3796
- }
3797
- reject(record.arg);
3798
- }
3799
- var previousPromise;
3800
- defineProperty(this, "_invoke", {
3801
- value: function value(method, arg) {
3802
- function callInvokeWithMethodAndArg() {
3803
- return new PromiseImpl(function (resolve, reject) {
3804
- invoke(method, arg, resolve, reject);
3805
- });
3806
- }
3807
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
3808
- }
3809
- });
3810
- }
3811
- function makeInvokeMethod(innerFn, self, context) {
3812
- var state = "suspendedStart";
3813
- return function (method, arg) {
3814
- if ("executing" === state) throw new Error("Generator is already running");
3815
- if ("completed" === state) {
3816
- if ("throw" === method) throw arg;
3817
- return doneResult();
3818
- }
3819
- for (context.method = method, context.arg = arg;;) {
3820
- var delegate = context.delegate;
3821
- if (delegate) {
3822
- var delegateResult = maybeInvokeDelegate(delegate, context);
3823
- if (delegateResult) {
3824
- if (delegateResult === ContinueSentinel) continue;
3825
- return delegateResult;
3826
- }
3827
- }
3828
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
3829
- if ("suspendedStart" === state) throw state = "completed", context.arg;
3830
- context.dispatchException(context.arg);
3831
- } else "return" === context.method && context.abrupt("return", context.arg);
3832
- state = "executing";
3833
- var record = tryCatch(innerFn, self, context);
3834
- if ("normal" === record.type) {
3835
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
3836
- return {
3837
- value: record.arg,
3838
- done: context.done
3839
- };
3840
- }
3841
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
3842
- }
3843
- };
3844
- }
3845
- function maybeInvokeDelegate(delegate, context) {
3846
- var methodName = context.method,
3847
- method = delegate.iterator[methodName];
3848
- 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;
3849
- var record = tryCatch(method, delegate.iterator, context.arg);
3850
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
3851
- var info = record.arg;
3852
- 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);
3853
- }
3854
- function pushTryEntry(locs) {
3855
- var entry = {
3856
- tryLoc: locs[0]
3857
- };
3858
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
3859
- }
3860
- function resetTryEntry(entry) {
3861
- var record = entry.completion || {};
3862
- record.type = "normal", delete record.arg, entry.completion = record;
3863
- }
3864
- function Context(tryLocsList) {
3865
- this.tryEntries = [{
3866
- tryLoc: "root"
3867
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
3868
- }
3869
- function values(iterable) {
3870
- if (iterable) {
3871
- var iteratorMethod = iterable[iteratorSymbol];
3872
- if (iteratorMethod) return iteratorMethod.call(iterable);
3873
- if ("function" == typeof iterable.next) return iterable;
3874
- if (!isNaN(iterable.length)) {
3875
- var i = -1,
3876
- next = function next() {
3877
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
3878
- return next.value = undefined, next.done = !0, next;
3879
- };
3880
- return next.next = next;
3881
- }
3882
- }
3883
- return {
3884
- next: doneResult
3885
- };
3886
- }
3887
- function doneResult() {
3888
- return {
3889
- value: undefined,
3890
- done: !0
3891
- };
3892
- }
3893
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
3894
- value: GeneratorFunctionPrototype,
3895
- configurable: !0
3896
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
3897
- value: GeneratorFunction,
3898
- configurable: !0
3899
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
3900
- var ctor = "function" == typeof genFun && genFun.constructor;
3901
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
3902
- }, exports.mark = function (genFun) {
3903
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
3904
- }, exports.awrap = function (arg) {
3905
- return {
3906
- __await: arg
3907
- };
3908
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
3909
- return this;
3910
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
3911
- void 0 === PromiseImpl && (PromiseImpl = Promise);
3912
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
3913
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
3914
- return result.done ? result.value : iter.next();
3915
- });
3916
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
3917
- return this;
3918
- }), define(Gp, "toString", function () {
3919
- return "[object Generator]";
3920
- }), exports.keys = function (val) {
3921
- var object = Object(val),
3922
- keys = [];
3923
- for (var key in object) keys.push(key);
3924
- return keys.reverse(), function next() {
3925
- for (; keys.length;) {
3926
- var key = keys.pop();
3927
- if (key in object) return next.value = key, next.done = !1, next;
3928
- }
3929
- return next.done = !0, next;
3930
- };
3931
- }, exports.values = values, Context.prototype = {
3932
- constructor: Context,
3933
- reset: function reset(skipTempReset) {
3934
- 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);
3935
- },
3936
- stop: function stop() {
3937
- this.done = !0;
3938
- var rootRecord = this.tryEntries[0].completion;
3939
- if ("throw" === rootRecord.type) throw rootRecord.arg;
3940
- return this.rval;
3941
- },
3942
- dispatchException: function dispatchException(exception) {
3943
- if (this.done) throw exception;
3944
- var context = this;
3945
- function handle(loc, caught) {
3946
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
3947
- }
3948
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3949
- var entry = this.tryEntries[i],
3950
- record = entry.completion;
3951
- if ("root" === entry.tryLoc) return handle("end");
3952
- if (entry.tryLoc <= this.prev) {
3953
- var hasCatch = hasOwn.call(entry, "catchLoc"),
3954
- hasFinally = hasOwn.call(entry, "finallyLoc");
3955
- if (hasCatch && hasFinally) {
3956
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
3957
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
3958
- } else if (hasCatch) {
3959
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
3960
- } else {
3961
- if (!hasFinally) throw new Error("try statement without catch or finally");
3962
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
3963
- }
3964
- }
3965
- }
3966
- },
3967
- abrupt: function abrupt(type, arg) {
3968
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3969
- var entry = this.tryEntries[i];
3970
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
3971
- var finallyEntry = entry;
3972
- break;
3973
- }
3974
- }
3975
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
3976
- var record = finallyEntry ? finallyEntry.completion : {};
3977
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
3978
- },
3979
- complete: function complete(record, afterLoc) {
3980
- if ("throw" === record.type) throw record.arg;
3981
- 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;
3982
- },
3983
- finish: function finish(finallyLoc) {
3984
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3985
- var entry = this.tryEntries[i];
3986
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
3987
- }
3988
- },
3989
- "catch": function _catch(tryLoc) {
3990
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3991
- var entry = this.tryEntries[i];
3992
- if (entry.tryLoc === tryLoc) {
3993
- var record = entry.completion;
3994
- if ("throw" === record.type) {
3995
- var thrown = record.arg;
3996
- resetTryEntry(entry);
3997
- }
3998
- return thrown;
3999
- }
4000
- }
4001
- throw new Error("illegal catch attempt");
4002
- },
4003
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
4004
- return this.delegate = {
4005
- iterator: values(iterable),
4006
- resultName: resultName,
4007
- nextLoc: nextLoc
4008
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
4009
- }
4010
- }, exports;
4011
- }
4012
- module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
4013
- } (regeneratorRuntime$1));
4014
-
4015
- // TODO(Babel 8): Remove this file.
4016
-
4017
- var runtime = regeneratorRuntime$1.exports();
4018
- var regenerator = runtime;
4019
-
4020
- // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
4021
- try {
4022
- regeneratorRuntime = runtime;
4023
- } catch (accidentalStrictMode) {
4024
- if (typeof globalThis === "object") {
4025
- globalThis.regeneratorRuntime = runtime;
4026
- } else {
4027
- Function("r", "regeneratorRuntime = r")(runtime);
4028
- }
4029
- }
4030
-
4031
- // THIS FILE HAS BEEN ADDED BY NEETO NOTIFICATIONS ENGINE
4032
- var devicesBaseUrl = "/neeto_notifications/api/v1/devices";
4033
- var create = function create(payload) {
4034
- return axios__default["default"].post(devicesBaseUrl, payload);
4035
- };
4036
- var destroy = function destroy(deviceId) {
4037
- return axios__default["default"]["delete"]("".concat(devicesBaseUrl, "/").concat(deviceId));
4038
- };
4039
- var devicesApi = {
4040
- create: create,
4041
- destroy: destroy
4042
- };
4043
-
4044
- // THIS FILE HAS BEEN ADDED BY NEETO NOTIFICATIONS ENGINE
4045
- // AND IS USED FOR BROWSER NOTIFICATIONS
4046
- // CONTACT NEETO NOTIFICATIONS TEAM BEFORE MODIFYING THIS FILE
4047
-
4048
- function urlB64ToUint8Array(base64String) {
4049
- var padding = "=".repeat((4 - base64String.length % 4) % 4);
4050
- var base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
4051
- var rawData = window.atob(base64);
4052
- var outputArray = new Uint8Array(rawData.length);
4053
- for (var i = 0; i < rawData.length; ++i) {
4054
- outputArray[i] = rawData.charCodeAt(i);
4055
- }
4056
- return outputArray;
4057
- }
4058
- var subscribeBrowserNotifications = /*#__PURE__*/function () {
4059
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(vapidPublicKey) {
4060
- var subscription, permission, sw;
4061
- return regenerator.wrap(function _callee$(_context) {
4062
- while (1) switch (_context.prev = _context.next) {
4063
- case 0:
4064
- subscription = {};
4065
- _context.prev = 1;
4066
- _context.next = 4;
4067
- return Notification.requestPermission();
4068
- case 4:
4069
- permission = _context.sent;
4070
- if (!(permission !== "denied")) {
4071
- _context.next = 15;
4072
- break;
4073
- }
4074
- _context.next = 8;
4075
- return navigator.serviceWorker.register("/serviceworker.js");
4076
- case 8:
4077
- _context.next = 10;
4078
- return navigator.serviceWorker.ready;
4079
- case 10:
4080
- sw = _context.sent;
4081
- _context.next = 13;
4082
- return sw.pushManager.subscribe({
4083
- userVisibleOnly: true,
4084
- applicationServerKey: urlB64ToUint8Array(vapidPublicKey)
4085
- });
4086
- case 13:
4087
- subscription = _context.sent;
4088
- return _context.abrupt("return", subscription);
4089
- case 15:
4090
- logger.error("Notification Permission Denied");
4091
- _context.next = 21;
4092
- break;
4093
- case 18:
4094
- _context.prev = 18;
4095
- _context.t0 = _context["catch"](1);
4096
- logger.error(_context.t0);
4097
- case 21:
4098
- return _context.abrupt("return", null);
4099
- case 22:
4100
- case "end":
4101
- return _context.stop();
4102
- }
4103
- }, _callee, null, [[1, 18]]);
4104
- }));
4105
- return function subscribeBrowserNotifications(_x) {
4106
- return _ref.apply(this, arguments);
4107
- };
4108
- }();
4109
- var unsubscribeBrowserNotifications = /*#__PURE__*/function () {
4110
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
4111
- var sw, subscription, res;
4112
- return regenerator.wrap(function _callee2$(_context2) {
4113
- while (1) switch (_context2.prev = _context2.next) {
4114
- case 0:
4115
- _context2.prev = 0;
4116
- _context2.next = 3;
4117
- return navigator.serviceWorker.ready;
4118
- case 3:
4119
- sw = _context2.sent;
4120
- _context2.next = 6;
4121
- return sw.pushManager.getSubscription();
4122
- case 6:
4123
- subscription = _context2.sent;
4124
- if (!subscription) {
4125
- _context2.next = 12;
4126
- break;
4127
- }
4128
- _context2.next = 10;
4129
- return subscription.unsubscribe();
4130
- case 10:
4131
- res = _context2.sent;
4132
- logger.error(res);
4133
- case 12:
4134
- _context2.next = 17;
4135
- break;
4136
- case 14:
4137
- _context2.prev = 14;
4138
- _context2.t0 = _context2["catch"](0);
4139
- logger.error(_context2.t0);
4140
- case 17:
4141
- case "end":
4142
- return _context2.stop();
4143
- }
4144
- }, _callee2, null, [[0, 14]]);
4145
- }));
4146
- return function unsubscribeBrowserNotifications() {
4147
- return _ref2.apply(this, arguments);
4148
- };
4149
- }();
4150
- var registerServiceWorker = /*#__PURE__*/function () {
4151
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(vapidPublicKey) {
4152
- var res;
4153
- return regenerator.wrap(function _callee3$(_context3) {
4154
- while (1) switch (_context3.prev = _context3.next) {
4155
- case 0:
4156
- if (!(navigator.serviceWorker && vapidPublicKey)) {
4157
- _context3.next = 5;
4158
- break;
4159
- }
4160
- _context3.next = 3;
4161
- return subscribeBrowserNotifications(vapidPublicKey);
4162
- case 3:
4163
- res = _context3.sent;
4164
- return _context3.abrupt("return", res);
4165
- case 5:
4166
- logger.error("Service worker is not supported in this Browser");
4167
- return _context3.abrupt("return", null);
4168
- case 7:
4169
- case "end":
4170
- return _context3.stop();
4171
- }
4172
- }, _callee3);
4173
- }));
4174
- return function registerServiceWorker(_x2) {
4175
- return _ref3.apply(this, arguments);
4176
- };
4177
- }();
4178
-
4179
- var createBrowserSubscription = /*#__PURE__*/function () {
4180
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(subscription) {
4181
- var payload;
4182
- return regenerator.wrap(function _callee$(_context) {
4183
- while (1) switch (_context.prev = _context.next) {
4184
- case 0:
4185
- if (!subscription) {
4186
- _context.next = 13;
4187
- break;
4188
- }
4189
- payload = {
4190
- device: {
4191
- subscription: subscription,
4192
- platform: "browser"
4193
- }
4194
- };
4195
- _context.prev = 2;
4196
- _context.next = 5;
4197
- return devicesApi.create(payload);
4198
- case 5:
4199
- localStorage.setItem("deviceId", JSON.stringify(subscription.toJSON().keys.auth));
4200
- _context.next = 11;
4201
- break;
4202
- case 8:
4203
- _context.prev = 8;
4204
- _context.t0 = _context["catch"](2);
4205
- logger.error("Device registration Failed: ", _context.t0);
4206
- case 11:
4207
- _context.next = 14;
4208
- break;
4209
- case 13:
4210
- logger.error("Something went wrong while registering device for browser subscription");
4211
- case 14:
4212
- case "end":
4213
- return _context.stop();
4214
- }
4215
- }, _callee, null, [[2, 8]]);
4216
- }));
4217
- return function createBrowserSubscription(_x) {
4218
- return _ref.apply(this, arguments);
4219
- };
4220
- }();
4221
- var destroyBrowserSubscription = /*#__PURE__*/function () {
4222
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
4223
- var deviceId;
4224
- return regenerator.wrap(function _callee2$(_context2) {
4225
- while (1) switch (_context2.prev = _context2.next) {
4226
- case 0:
4227
- _context2.prev = 0;
4228
- _context2.next = 3;
4229
- return unsubscribeBrowserNotifications();
4230
- case 3:
4231
- deviceId = JSON.parse(localStorage.getItem("deviceId"));
4232
- _context2.next = 6;
4233
- return devicesApi.destroy(deviceId);
4234
- case 6:
4235
- localStorage.removeItem("deviceId");
4236
- _context2.next = 12;
4237
- break;
4238
- case 9:
4239
- _context2.prev = 9;
4240
- _context2.t0 = _context2["catch"](0);
4241
- logger.error("Something went wrong while unsubscribing browser notification:", _context2.t0);
4242
- case 12:
4243
- case "end":
4244
- return _context2.stop();
4245
- }
4246
- }, _callee2, null, [[0, 9]]);
4247
- }));
4248
- return function destroyBrowserSubscription() {
4249
- return _ref2.apply(this, arguments);
4250
- };
4251
- }();
4252
- var registerBrowserNotifications = /*#__PURE__*/function () {
4253
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
4254
- var vapidPublicKey,
4255
- response,
4256
- _args3 = arguments;
4257
- return regenerator.wrap(function _callee3$(_context3) {
4258
- while (1) switch (_context3.prev = _context3.next) {
4259
- case 0:
4260
- vapidPublicKey = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : process.env.VAPID_PUBLIC_KEY;
4261
- _context3.next = 3;
4262
- return registerServiceWorker(vapidPublicKey);
4263
- case 3:
4264
- response = _context3.sent;
4265
- _context3.next = 6;
4266
- return createBrowserSubscription(response);
4267
- case 6:
4268
- case "end":
4269
- return _context3.stop();
4270
- }
4271
- }, _callee3);
4272
- }));
4273
- return function registerBrowserNotifications() {
4274
- return _ref3.apply(this, arguments);
4275
- };
4276
- }();
4277
-
4278
- var handleMetaClick = ramda.curry(function (history, params, event) {
4279
- return isMetaKeyPressed(event) ? window.open(params.pathname || params, "_blank") : history.push(params);
4280
- });
4281
- var isMetaKeyPressed = function isMetaKeyPressed(event) {
4282
- return !!(event !== null && event !== void 0 && event.ctrlKey || event !== null && event !== void 0 && event.metaKey);
4283
- };
4284
-
4285
- var withT = function withT(Component, options) {
4286
- var namespace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
4287
- return reactI18next.withTranslation(namespace, options)(Component);
4288
- };
4289
-
4290
- var withTitle = function withTitle(Component) {
4291
- var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
4292
- var PageTitle = function PageTitle(props) {
4293
- var pageTitle = title ? "".concat(title, " | ").concat(globalProps.appName) : globalProps.appName;
4294
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(reactHelmet.Helmet, null, /*#__PURE__*/React__default["default"].createElement("title", null, pageTitle)), /*#__PURE__*/React__default["default"].createElement(Component, props));
4295
- };
4296
- return PageTitle;
4297
- };
4298
-
4299
- var setWithoutModifyingActions = function setWithoutModifyingActions(set) {
4300
- return function (partial) {
4301
- return set(function (previous) {
4302
- if (typeof partial === "function") partial = partial(previous);
4303
- var overwrittenActions = ramda.keys(partial).filter(function (key) {
4304
- return typeof (previous === null || previous === void 0 ? void 0 : previous[key]) === "function" && partial[key] !== previous[key];
4305
- });
4306
- if (!ramda.isEmpty(overwrittenActions)) {
4307
- throw new Error("Actions should not be modified. Touched action(s): ".concat(overwrittenActions.join(", ")));
4308
- }
4309
- return partial;
4310
- }, false);
4311
- };
4312
- };
4313
- var withImmutableActions = function withImmutableActions(config) {
4314
- return function (set, get, api) {
4315
- return config(setWithoutModifyingActions(set), get, api);
4316
- };
4317
- };
4318
-
4319
- /** @type {import("neetocommons/react-utils").ZustandStoreHook} */
4320
- var useCheckpointStore = create$1(withImmutableActions(function (set) {
4321
- return {
4322
- checkpoints: {},
4323
- setCheckpoint: function setCheckpoint(key, path) {
4324
- return set(ramda.mergeDeepLeft({
4325
- checkpoints: _defineProperty({}, key, path)
4326
- }));
4327
- }
4328
- };
4329
- }));
4330
- var useRegisterNavigationCheckpoint = function useRegisterNavigationCheckpoint(key) {
4331
- var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.pathname + window.location.search;
4332
- var setCheckpoint = useCheckpointStore(ramda.prop("setCheckpoint"));
4333
- React.useEffect(function () {
4334
- setCheckpoint(key, path);
4335
- }, [key, path]);
4336
- };
4337
- var useNavigationCheckpoints = function useNavigationCheckpoints() {
4338
- for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
4339
- keys[_key] = arguments[_key];
4340
- }
4341
- return useCheckpointStore(function (store) {
4342
- return ramda.pick(keys, store.checkpoints);
4343
- }, shallow);
4344
- };
4345
-
4346
- var useStateWithDependency = function useStateWithDependency(defaultValue) {
4347
- var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [defaultValue];
4348
- var _useState = React.useState(defaultValue),
4349
- _useState2 = _slicedToArray(_useState, 2),
4350
- value = _useState2[0],
4351
- setValue = _useState2[1];
4352
- React.useEffect(function () {
4353
- setValue(defaultValue);
4354
- }, dependencies);
4355
- return [value, setValue];
4356
- };
4357
-
4358
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
4359
- // require the crypto API and do not support built-in fallback to lower quality random number
4360
- // generators (like Math.random()).
4361
- let getRandomValues;
4362
- const rnds8 = new Uint8Array(16);
4363
- function rng() {
4364
- // lazy load so that environments that need to polyfill have a chance to do so
4365
- if (!getRandomValues) {
4366
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
4367
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
4368
-
4369
- if (!getRandomValues) {
4370
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
4371
- }
4372
- }
4373
-
4374
- return getRandomValues(rnds8);
4375
- }
4376
-
4377
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
4378
-
4379
- function validate(uuid) {
4380
- return typeof uuid === 'string' && REGEX.test(uuid);
4381
- }
4382
-
4383
- /**
4384
- * Convert array of 16 byte values to UUID string format of the form:
4385
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4386
- */
4387
-
4388
- const byteToHex = [];
4389
-
4390
- for (let i = 0; i < 256; ++i) {
4391
- byteToHex.push((i + 0x100).toString(16).slice(1));
4392
- }
4393
-
4394
- function unsafeStringify(arr, offset = 0) {
4395
- // Note: Be careful editing this code! It's been tuned for performance
4396
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
4397
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
4398
- }
4399
-
4400
- function parse(uuid) {
4401
- if (!validate(uuid)) {
4402
- throw TypeError('Invalid UUID');
4403
- }
4404
-
4405
- let v;
4406
- const arr = new Uint8Array(16); // Parse ########-....-....-....-............
4407
-
4408
- arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
4409
- arr[1] = v >>> 16 & 0xff;
4410
- arr[2] = v >>> 8 & 0xff;
4411
- arr[3] = v & 0xff; // Parse ........-####-....-....-............
4412
-
4413
- arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
4414
- arr[5] = v & 0xff; // Parse ........-....-####-....-............
4415
-
4416
- arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
4417
- arr[7] = v & 0xff; // Parse ........-....-....-####-............
4418
-
4419
- arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
4420
- arr[9] = v & 0xff; // Parse ........-....-....-....-############
4421
- // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
4422
-
4423
- arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
4424
- arr[11] = v / 0x100000000 & 0xff;
4425
- arr[12] = v >>> 24 & 0xff;
4426
- arr[13] = v >>> 16 & 0xff;
4427
- arr[14] = v >>> 8 & 0xff;
4428
- arr[15] = v & 0xff;
4429
- return arr;
4430
- }
4431
-
4432
- function stringToBytes(str) {
4433
- str = unescape(encodeURIComponent(str)); // UTF8 escape
4434
-
4435
- const bytes = [];
4436
-
4437
- for (let i = 0; i < str.length; ++i) {
4438
- bytes.push(str.charCodeAt(i));
4439
- }
4440
-
4441
- return bytes;
4442
- }
4443
-
4444
- const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
4445
- const URL$1 = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
4446
- function v35(name, version, hashfunc) {
4447
- function generateUUID(value, namespace, buf, offset) {
4448
- var _namespace;
4449
-
4450
- if (typeof value === 'string') {
4451
- value = stringToBytes(value);
4452
- }
4453
-
4454
- if (typeof namespace === 'string') {
4455
- namespace = parse(namespace);
4456
- }
4457
-
4458
- if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
4459
- throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
4460
- } // Compute hash of namespace and value, Per 4.3
4461
- // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
4462
- // hashfunc([...namespace, ... value])`
4463
-
4464
-
4465
- let bytes = new Uint8Array(16 + value.length);
4466
- bytes.set(namespace);
4467
- bytes.set(value, namespace.length);
4468
- bytes = hashfunc(bytes);
4469
- bytes[6] = bytes[6] & 0x0f | version;
4470
- bytes[8] = bytes[8] & 0x3f | 0x80;
4471
-
4472
- if (buf) {
4473
- offset = offset || 0;
4474
-
4475
- for (let i = 0; i < 16; ++i) {
4476
- buf[offset + i] = bytes[i];
4477
- }
4478
-
4479
- return buf;
4480
- }
4481
-
4482
- return unsafeStringify(bytes);
4483
- } // Function#name is not settable on some platforms (#270)
4484
-
4485
-
4486
- try {
4487
- generateUUID.name = name; // eslint-disable-next-line no-empty
4488
- } catch (err) {} // For CommonJS default export support
4489
-
4490
-
4491
- generateUUID.DNS = DNS;
4492
- generateUUID.URL = URL$1;
4493
- return generateUUID;
4494
- }
4495
-
4496
- /*
4497
- * Browser-compatible JavaScript MD5
4498
- *
4499
- * Modification of JavaScript MD5
4500
- * https://github.com/blueimp/JavaScript-MD5
4501
- *
4502
- * Copyright 2011, Sebastian Tschan
4503
- * https://blueimp.net
4504
- *
4505
- * Licensed under the MIT license:
4506
- * https://opensource.org/licenses/MIT
4507
- *
4508
- * Based on
4509
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
4510
- * Digest Algorithm, as defined in RFC 1321.
4511
- * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
4512
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
4513
- * Distributed under the BSD License
4514
- * See http://pajhome.org.uk/crypt/md5 for more info.
4515
- */
4516
- function md5(bytes) {
4517
- if (typeof bytes === 'string') {
4518
- const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
4519
-
4520
- bytes = new Uint8Array(msg.length);
4521
-
4522
- for (let i = 0; i < msg.length; ++i) {
4523
- bytes[i] = msg.charCodeAt(i);
4524
- }
4525
- }
4526
-
4527
- return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
4528
- }
4529
- /*
4530
- * Convert an array of little-endian words to an array of bytes
4531
- */
4532
-
4533
-
4534
- function md5ToHexEncodedArray(input) {
4535
- const output = [];
4536
- const length32 = input.length * 32;
4537
- const hexTab = '0123456789abcdef';
4538
-
4539
- for (let i = 0; i < length32; i += 8) {
4540
- const x = input[i >> 5] >>> i % 32 & 0xff;
4541
- const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
4542
- output.push(hex);
4543
- }
4544
-
4545
- return output;
4546
- }
4547
- /**
4548
- * Calculate output length with padding and bit length
4549
- */
4550
-
4551
-
4552
- function getOutputLength(inputLength8) {
4553
- return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
4554
- }
4555
- /*
4556
- * Calculate the MD5 of an array of little-endian words, and a bit length.
4557
- */
4558
-
4559
-
4560
- function wordsToMd5(x, len) {
4561
- /* append padding */
4562
- x[len >> 5] |= 0x80 << len % 32;
4563
- x[getOutputLength(len) - 1] = len;
4564
- let a = 1732584193;
4565
- let b = -271733879;
4566
- let c = -1732584194;
4567
- let d = 271733878;
4568
-
4569
- for (let i = 0; i < x.length; i += 16) {
4570
- const olda = a;
4571
- const oldb = b;
4572
- const oldc = c;
4573
- const oldd = d;
4574
- a = md5ff(a, b, c, d, x[i], 7, -680876936);
4575
- d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
4576
- c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
4577
- b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
4578
- a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
4579
- d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
4580
- c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
4581
- b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
4582
- a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
4583
- d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
4584
- c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
4585
- b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
4586
- a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
4587
- d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
4588
- c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
4589
- b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
4590
- a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
4591
- d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
4592
- c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
4593
- b = md5gg(b, c, d, a, x[i], 20, -373897302);
4594
- a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
4595
- d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
4596
- c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
4597
- b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
4598
- a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
4599
- d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
4600
- c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
4601
- b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
4602
- a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
4603
- d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
4604
- c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
4605
- b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
4606
- a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
4607
- d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
4608
- c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
4609
- b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
4610
- a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
4611
- d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
4612
- c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
4613
- b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
4614
- a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
4615
- d = md5hh(d, a, b, c, x[i], 11, -358537222);
4616
- c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
4617
- b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
4618
- a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
4619
- d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
4620
- c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
4621
- b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
4622
- a = md5ii(a, b, c, d, x[i], 6, -198630844);
4623
- d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
4624
- c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
4625
- b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
4626
- a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
4627
- d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
4628
- c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
4629
- b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
4630
- a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
4631
- d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
4632
- c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
4633
- b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
4634
- a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
4635
- d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
4636
- c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
4637
- b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
4638
- a = safeAdd(a, olda);
4639
- b = safeAdd(b, oldb);
4640
- c = safeAdd(c, oldc);
4641
- d = safeAdd(d, oldd);
4642
- }
4643
-
4644
- return [a, b, c, d];
4645
- }
4646
- /*
4647
- * Convert an array bytes to an array of little-endian words
4648
- * Characters >255 have their high-byte silently ignored.
4649
- */
4650
-
4651
-
4652
- function bytesToWords(input) {
4653
- if (input.length === 0) {
4654
- return [];
4655
- }
4656
-
4657
- const length8 = input.length * 8;
4658
- const output = new Uint32Array(getOutputLength(length8));
4659
-
4660
- for (let i = 0; i < length8; i += 8) {
4661
- output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
4662
- }
4663
-
4664
- return output;
4665
- }
4666
- /*
4667
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
4668
- * to work around bugs in some JS interpreters.
4669
- */
4670
-
4671
-
4672
- function safeAdd(x, y) {
4673
- const lsw = (x & 0xffff) + (y & 0xffff);
4674
- const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
4675
- return msw << 16 | lsw & 0xffff;
4676
- }
4677
- /*
4678
- * Bitwise rotate a 32-bit number to the left.
4679
- */
4680
-
4681
-
4682
- function bitRotateLeft(num, cnt) {
4683
- return num << cnt | num >>> 32 - cnt;
4684
- }
4685
- /*
4686
- * These functions implement the four basic operations the algorithm uses.
4687
- */
4688
-
4689
-
4690
- function md5cmn(q, a, b, x, s, t) {
4691
- return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
4692
- }
4693
-
4694
- function md5ff(a, b, c, d, x, s, t) {
4695
- return md5cmn(b & c | ~b & d, a, b, x, s, t);
4696
- }
4697
-
4698
- function md5gg(a, b, c, d, x, s, t) {
4699
- return md5cmn(b & d | c & ~d, a, b, x, s, t);
4700
- }
4701
-
4702
- function md5hh(a, b, c, d, x, s, t) {
4703
- return md5cmn(b ^ c ^ d, a, b, x, s, t);
4704
- }
4705
-
4706
- function md5ii(a, b, c, d, x, s, t) {
4707
- return md5cmn(c ^ (b | ~d), a, b, x, s, t);
4708
- }
4709
-
4710
- v35('v3', 0x30, md5);
4711
-
4712
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
4713
- var native = {
4714
- randomUUID
4715
- };
4716
-
4717
- function v4(options, buf, offset) {
4718
- if (native.randomUUID && !buf && !options) {
4719
- return native.randomUUID();
4720
- }
4721
-
4722
- options = options || {};
4723
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
4724
-
4725
- rnds[6] = rnds[6] & 0x0f | 0x40;
4726
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
4727
-
4728
- if (buf) {
4729
- offset = offset || 0;
4730
-
4731
- for (let i = 0; i < 16; ++i) {
4732
- buf[offset + i] = rnds[i];
4733
- }
4734
-
4735
- return buf;
4736
- }
4737
-
4738
- return unsafeStringify(rnds);
4739
- }
4740
-
4741
- // Adapted from Chris Veness' SHA1 code at
4742
- // http://www.movable-type.co.uk/scripts/sha1.html
4743
- function f(s, x, y, z) {
4744
- switch (s) {
4745
- case 0:
4746
- return x & y ^ ~x & z;
4747
-
4748
- case 1:
4749
- return x ^ y ^ z;
4750
-
4751
- case 2:
4752
- return x & y ^ x & z ^ y & z;
4753
-
4754
- case 3:
4755
- return x ^ y ^ z;
4756
- }
4757
- }
4758
-
4759
- function ROTL(x, n) {
4760
- return x << n | x >>> 32 - n;
4761
- }
4762
-
4763
- function sha1(bytes) {
4764
- const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
4765
- const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
4766
-
4767
- if (typeof bytes === 'string') {
4768
- const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
4769
-
4770
- bytes = [];
4771
-
4772
- for (let i = 0; i < msg.length; ++i) {
4773
- bytes.push(msg.charCodeAt(i));
4774
- }
4775
- } else if (!Array.isArray(bytes)) {
4776
- // Convert Array-like to Array
4777
- bytes = Array.prototype.slice.call(bytes);
4778
- }
4779
-
4780
- bytes.push(0x80);
4781
- const l = bytes.length / 4 + 2;
4782
- const N = Math.ceil(l / 16);
4783
- const M = new Array(N);
4784
-
4785
- for (let i = 0; i < N; ++i) {
4786
- const arr = new Uint32Array(16);
4787
-
4788
- for (let j = 0; j < 16; ++j) {
4789
- arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
4790
- }
4791
-
4792
- M[i] = arr;
4793
- }
4794
-
4795
- M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
4796
- M[N - 1][14] = Math.floor(M[N - 1][14]);
4797
- M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
4798
-
4799
- for (let i = 0; i < N; ++i) {
4800
- const W = new Uint32Array(80);
4801
-
4802
- for (let t = 0; t < 16; ++t) {
4803
- W[t] = M[i][t];
4804
- }
4805
-
4806
- for (let t = 16; t < 80; ++t) {
4807
- W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
4808
- }
4809
-
4810
- let a = H[0];
4811
- let b = H[1];
4812
- let c = H[2];
4813
- let d = H[3];
4814
- let e = H[4];
4815
-
4816
- for (let t = 0; t < 80; ++t) {
4817
- const s = Math.floor(t / 20);
4818
- const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
4819
- e = d;
4820
- d = c;
4821
- c = ROTL(b, 30) >>> 0;
4822
- b = a;
4823
- a = T;
4824
- }
4825
-
4826
- H[0] = H[0] + a >>> 0;
4827
- H[1] = H[1] + b >>> 0;
4828
- H[2] = H[2] + c >>> 0;
4829
- H[3] = H[3] + d >>> 0;
4830
- H[4] = H[4] + e >>> 0;
4831
- }
4832
-
4833
- return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
4834
- }
4835
-
4836
- v35('v5', 0x50, sha1);
4837
-
4838
- var useTimerStore = create$1(function () {
4839
- return {};
4840
- });
4841
- setInterval(function () {
4842
- var currentState = useTimerStore.getState();
4843
- var nextState = {};
4844
- var now = Date.now();
4845
- for (var key in currentState) {
4846
- var _currentState$key = currentState[key],
4847
- lastUpdated = _currentState$key.lastUpdated,
4848
- interval = _currentState$key.interval;
4849
- var shouldUpdate = now - lastUpdated >= interval;
4850
- if (shouldUpdate) nextState[key] = {
4851
- lastUpdated: now,
4852
- interval: interval
4853
- };
4854
- }
4855
- if (!ramda.isEmpty(nextState)) useTimerStore.setState(nextState);
4856
- }, 1000);
4857
- var useTimer = function useTimer() {
4858
- var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 60;
4859
- var key = React.useMemo(function () {
4860
- return v4();
4861
- }, []);
4862
- React.useEffect(function () {
4863
- useTimerStore.setState(_defineProperty({}, key, {
4864
- lastUpdated: Date.now(),
4865
- interval: 1000 * interval // convert seconds to ms
4866
- }));
4867
-
4868
- return function () {
4869
- return useTimerStore.setState(ramda.omit([key], useTimerStore.getState()), true);
4870
- };
4871
- }, [interval, key]);
4872
- return useTimerStore(ramda.prop(key));
4873
- };
4874
-
4875
- var useUpdateEffect = function useUpdateEffect(callback) {
4876
- var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
4877
- var isInitialMount = React.useRef(true);
4878
- React.useEffect(function () {
4879
- if (isInitialMount.current) {
4880
- isInitialMount.current = false;
4881
- return;
4882
- }
4883
- callback();
4884
- }, dependencies);
4885
- };
4886
-
4887
- exports.HoneybadgerErrorBoundary = HoneybadgerErrorBoundary;
4888
- exports.PrivateRoute = PrivateRoute;
4889
- exports.destroyBrowserSubscription = destroyBrowserSubscription;
4890
- exports.handleMetaClick = handleMetaClick;
4891
- exports.isMetaKeyPressed = isMetaKeyPressed;
4892
- exports.registerBrowserNotifications = registerBrowserNotifications;
4893
- exports.useDebounce = useDebounce;
4894
- exports.useDisplayErrorPage = useDisplayErrorPage;
4895
- exports.useErrorDisplayStore = useErrorDisplayStore;
4896
- exports.useFetchNeetoApps = useFetchNeetoApps;
4897
- exports.useFuncDebounce = useFuncDebounce;
4898
- exports.useHotKeys = useHotKeys;
4899
- exports.useIsElementVisibleInDom = useIsElementVisibleInDom;
4900
- exports.useKeyboardShortcutsPaneState = useKeyboardShortcutsPaneState;
4901
- exports.useLocalStorage = useLocalStorage;
4902
- exports.useMutationWithInvalidation = useMutationWithInvalidation;
4903
- exports.useNavigationCheckpoints = useNavigationCheckpoints;
4904
- exports.useOnClickOutside = useOnClickOutside;
4905
- exports.usePersistedQuery = usePersistedQuery;
4906
- exports.usePrevious = usePrevious;
4907
- exports.useQueryParams = useQueryParams;
4908
- exports.useRegisterNavigationCheckpoint = useRegisterNavigationCheckpoint;
4909
- exports.useStateWithDependency = useStateWithDependency;
4910
- exports.useTimer = useTimer;
4911
- exports.useUpdateEffect = useUpdateEffect;
4912
- exports.withImmutableActions = withImmutableActions;
4913
- exports.withT = withT;
4914
- exports.withTitle = withTitle;
4915
- //# sourceMappingURL=react-utils.cjs.js.map