@genexus/genexus-ide-ui 1.0.19 → 1.0.21

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 (230) hide show
  1. package/dist/cjs/{form-validation-df39cabb.js → form-validation-0019e158.js} +2 -2
  2. package/dist/cjs/form-validation-0019e158.js.map +1 -0
  3. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  4. package/dist/cjs/gx-ide-ai-message.cjs.entry.js +1 -1
  5. package/dist/cjs/gx-ide-connect-gx-server.cjs.entry.js +1 -1
  6. package/dist/cjs/gx-ide-create-kb-from-server.cjs.entry.js +1 -1
  7. package/dist/cjs/gx-ide-dashboard-home.cjs.entry.js +1 -1
  8. package/dist/cjs/{gx-ide-empty-state_2.cjs.entry.js → gx-ide-empty-state.cjs.entry.js} +3 -56
  9. package/dist/cjs/gx-ide-empty-state.cjs.entry.js.map +1 -0
  10. package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +1 -1
  11. package/dist/cjs/gx-ide-loader.cjs.entry.js +61 -0
  12. package/dist/cjs/gx-ide-loader.cjs.entry.js.map +1 -0
  13. package/dist/cjs/gx-ide-new-environment.cjs.entry.js +2 -2
  14. package/dist/cjs/gx-ide-new-kb.cjs.entry.js +2 -2
  15. package/dist/cjs/gx-ide-object-selector.cjs.entry.js +1 -1
  16. package/dist/cjs/gx-ide-share-kb.cjs.entry.js +1 -1
  17. package/dist/cjs/gx-ide-splash.cjs.entry.js +76 -0
  18. package/dist/cjs/gx-ide-splash.cjs.entry.js.map +1 -0
  19. package/dist/cjs/gx-ide-start-page.cjs.entry.js +2644 -104
  20. package/dist/cjs/gx-ide-start-page.cjs.entry.js.map +1 -1
  21. package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +1 -1
  22. package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +1 -1
  23. package/dist/cjs/gx-ide-welcome-page.cjs.entry.js +257 -0
  24. package/dist/cjs/gx-ide-welcome-page.cjs.entry.js.map +1 -0
  25. package/dist/cjs/gx-ide-ww-images.cjs.entry.js +279 -396
  26. package/dist/cjs/gx-ide-ww-images.cjs.entry.js.map +1 -1
  27. package/dist/cjs/{helpers-19194a5a.js → helpers-b5b4a659.js} +7 -1
  28. package/dist/cjs/helpers-b5b4a659.js.map +1 -0
  29. package/dist/cjs/loader.cjs.js +1 -1
  30. package/dist/collection/collection-manifest.json +3 -2
  31. package/dist/collection/common/form-validation.js +1 -1
  32. package/dist/collection/common/form-validation.js.map +1 -1
  33. package/dist/collection/components/_helpers/ide-loader/ide-loader.css +4 -1
  34. package/dist/collection/components/_helpers/ide-loader/ide-loader.js +2 -2
  35. package/dist/collection/components/_helpers/ide-loader/ide-loader.js.map +1 -1
  36. package/dist/collection/components/splash/gx-ide-assets/splash/images/copyrights-illustration.png +0 -0
  37. package/dist/collection/components/splash/gx-ide-assets/splash/images/icon-next.svg +4 -0
  38. package/dist/collection/components/splash/gx-ide-assets/splash/langs/splash.lang.en.json +14 -0
  39. package/dist/collection/components/splash/gx-ide-assets/splash/langs/splash.lang.ja.json +13 -0
  40. package/dist/collection/components/splash/gx-ide-assets/splash/langs/splash.lang.zh.json +13 -0
  41. package/dist/collection/components/splash/splash.css +56 -0
  42. package/dist/collection/components/splash/splash.js +125 -0
  43. package/dist/collection/components/splash/splash.js.map +1 -0
  44. package/dist/collection/components/start-page/gx-ide-assets/start-page/langs/start-page.lang.en.json +19 -27
  45. package/dist/collection/components/start-page/gx-ide-assets/start-page/langs/start-page.lang.ja.json +18 -26
  46. package/dist/collection/components/start-page/gx-ide-assets/start-page/langs/start-page.lang.zh.json +23 -1
  47. package/dist/collection/components/start-page/start-page.css +142 -624
  48. package/dist/collection/components/start-page/start-page.js +198 -181
  49. package/dist/collection/components/start-page/start-page.js.map +1 -1
  50. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/arrow-next.svg +3 -0
  51. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/copyrights-base.svg +61 -0
  52. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/copyrights-illustration.png +0 -0
  53. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/fig-ellipse-blurred.svg +21 -0
  54. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/fig-ellipse-bottom-left.svg +14 -0
  55. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/fig-ellipse-top-left.svg +14 -0
  56. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/fig-polygon.svg +14 -0
  57. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/icon-next.svg +4 -0
  58. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/slide-1.svg +115 -0
  59. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/slide-2.svg +67 -0
  60. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/slide-3.svg +138 -0
  61. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/slide-4.svg +97 -0
  62. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/images/slide-5.svg +83 -0
  63. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/langs/welcome-page.lang.en.json +13 -0
  64. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/langs/welcome-page.lang.ja.json +13 -0
  65. package/dist/collection/components/welcome-page/gx-ide-assets/welcome-page/langs/welcome-page.lang.zh.json +13 -0
  66. package/dist/collection/components/welcome-page/welcome-page.css +264 -0
  67. package/dist/collection/components/welcome-page/welcome-page.js +360 -0
  68. package/dist/collection/components/welcome-page/welcome-page.js.map +1 -0
  69. package/dist/collection/components/ww-images/gx-ide-assets/ww-images/langs/ww-images.lang.en.json +3 -7
  70. package/dist/collection/components/ww-images/gx-ide-assets/ww-images/langs/ww-images.lang.ja.json +4 -8
  71. package/dist/collection/components/ww-images/ww-images.css +733 -80
  72. package/dist/collection/components/ww-images/ww-images.js +413 -465
  73. package/dist/collection/components/ww-images/ww-images.js.map +1 -1
  74. package/dist/collection/pages/assets/images/welcome-page/slide-1.svg +115 -0
  75. package/dist/collection/pages/assets/images/welcome-page/slide-2.svg +67 -0
  76. package/dist/collection/pages/assets/images/welcome-page/slide-3.svg +138 -0
  77. package/dist/collection/pages/assets/images/welcome-page/slide-4.svg +97 -0
  78. package/dist/collection/pages/assets/images/welcome-page/slide-5.svg +83 -0
  79. package/dist/components/form-validation.js +1 -1
  80. package/dist/components/form-validation.js.map +1 -1
  81. package/dist/components/{gx-ide-recent-news.d.ts → gx-ide-splash.d.ts} +4 -4
  82. package/dist/components/gx-ide-splash.js +96 -0
  83. package/dist/components/gx-ide-splash.js.map +1 -0
  84. package/dist/components/gx-ide-start-page.js +2654 -126
  85. package/dist/components/gx-ide-start-page.js.map +1 -1
  86. package/dist/components/gx-ide-welcome-page.d.ts +11 -0
  87. package/dist/components/gx-ide-welcome-page.js +283 -0
  88. package/dist/components/gx-ide-welcome-page.js.map +1 -0
  89. package/dist/components/gx-ide-ww-images.js +306 -419
  90. package/dist/components/gx-ide-ww-images.js.map +1 -1
  91. package/dist/components/helpers.js +6 -1
  92. package/dist/components/helpers.js.map +1 -1
  93. package/dist/components/ide-loader.js +3 -3
  94. package/dist/components/ide-loader.js.map +1 -1
  95. package/dist/esm/{form-validation-8b3f527c.js → form-validation-44b2c2a8.js} +2 -2
  96. package/dist/esm/form-validation-44b2c2a8.js.map +1 -0
  97. package/dist/esm/genexus-ide-ui.js +1 -1
  98. package/dist/esm/gx-ide-ai-message.entry.js +1 -1
  99. package/dist/esm/gx-ide-connect-gx-server.entry.js +1 -1
  100. package/dist/esm/gx-ide-create-kb-from-server.entry.js +1 -1
  101. package/dist/esm/gx-ide-dashboard-home.entry.js +1 -1
  102. package/dist/esm/{gx-ide-empty-state_2.entry.js → gx-ide-empty-state.entry.js} +5 -57
  103. package/dist/esm/gx-ide-empty-state.entry.js.map +1 -0
  104. package/dist/esm/gx-ide-kb-manager-import.entry.js +1 -1
  105. package/dist/esm/gx-ide-loader.entry.js +57 -0
  106. package/dist/esm/gx-ide-loader.entry.js.map +1 -0
  107. package/dist/esm/gx-ide-new-environment.entry.js +2 -2
  108. package/dist/esm/gx-ide-new-kb.entry.js +2 -2
  109. package/dist/esm/gx-ide-object-selector.entry.js +1 -1
  110. package/dist/esm/gx-ide-share-kb.entry.js +1 -1
  111. package/dist/esm/gx-ide-splash.entry.js +72 -0
  112. package/dist/esm/gx-ide-splash.entry.js.map +1 -0
  113. package/dist/esm/gx-ide-start-page.entry.js +2644 -104
  114. package/dist/esm/gx-ide-start-page.entry.js.map +1 -1
  115. package/dist/esm/gx-ide-team-dev-commit.entry.js +1 -1
  116. package/dist/esm/gx-ide-team-dev-update.entry.js +1 -1
  117. package/dist/esm/gx-ide-welcome-page.entry.js +253 -0
  118. package/dist/esm/gx-ide-welcome-page.entry.js.map +1 -0
  119. package/dist/esm/gx-ide-ww-images.entry.js +279 -396
  120. package/dist/esm/gx-ide-ww-images.entry.js.map +1 -1
  121. package/dist/esm/{helpers-9ee6ddce.js → helpers-64e1dd0b.js} +7 -2
  122. package/dist/esm/helpers-64e1dd0b.js.map +1 -0
  123. package/dist/esm/loader.js +1 -1
  124. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  125. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js.map +1 -1
  126. package/dist/genexus-ide-ui/gx-ide-assets/splash/images/copyrights-illustration.png +0 -0
  127. package/dist/genexus-ide-ui/gx-ide-assets/splash/images/icon-next.svg +4 -0
  128. package/dist/genexus-ide-ui/gx-ide-assets/splash/langs/splash.lang.en.json +14 -0
  129. package/dist/genexus-ide-ui/gx-ide-assets/splash/langs/splash.lang.ja.json +13 -0
  130. package/dist/genexus-ide-ui/gx-ide-assets/splash/langs/splash.lang.zh.json +13 -0
  131. package/dist/genexus-ide-ui/gx-ide-assets/start-page/langs/start-page.lang.en.json +19 -27
  132. package/dist/genexus-ide-ui/gx-ide-assets/start-page/langs/start-page.lang.ja.json +18 -26
  133. package/dist/genexus-ide-ui/gx-ide-assets/start-page/langs/start-page.lang.zh.json +23 -1
  134. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/arrow-next.svg +3 -0
  135. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/copyrights-base.svg +61 -0
  136. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/copyrights-illustration.png +0 -0
  137. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/fig-ellipse-blurred.svg +21 -0
  138. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/fig-ellipse-bottom-left.svg +14 -0
  139. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/fig-ellipse-top-left.svg +14 -0
  140. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/fig-polygon.svg +14 -0
  141. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/icon-next.svg +4 -0
  142. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/slide-1.svg +115 -0
  143. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/slide-2.svg +67 -0
  144. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/slide-3.svg +138 -0
  145. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/slide-4.svg +97 -0
  146. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/images/slide-5.svg +83 -0
  147. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/langs/welcome-page.lang.en.json +13 -0
  148. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/langs/welcome-page.lang.ja.json +13 -0
  149. package/dist/genexus-ide-ui/gx-ide-assets/welcome-page/langs/welcome-page.lang.zh.json +13 -0
  150. package/dist/genexus-ide-ui/gx-ide-assets/ww-images/langs/ww-images.lang.en.json +3 -7
  151. package/dist/genexus-ide-ui/gx-ide-assets/ww-images/langs/ww-images.lang.ja.json +4 -8
  152. package/dist/genexus-ide-ui/{p-d5d0ed5e.entry.js → p-02bc66c1.entry.js} +2 -2
  153. package/dist/genexus-ide-ui/p-120d283a.entry.js +2419 -0
  154. package/dist/genexus-ide-ui/p-120d283a.entry.js.map +1 -0
  155. package/dist/genexus-ide-ui/{p-c4d1d0ce.entry.js → p-39792ac8.entry.js} +2 -2
  156. package/dist/genexus-ide-ui/{p-c36effd2.entry.js → p-4a0dab98.entry.js} +3 -3
  157. package/dist/genexus-ide-ui/{p-acf0cbac.entry.js → p-4ce47bcd.entry.js} +2 -2
  158. package/dist/genexus-ide-ui/{p-fc64d088.entry.js → p-58e13823.entry.js} +2 -2
  159. package/dist/genexus-ide-ui/p-62f4ad99.entry.js +612 -0
  160. package/dist/genexus-ide-ui/p-62f4ad99.entry.js.map +1 -0
  161. package/dist/genexus-ide-ui/{p-98b5b178.entry.js → p-658755d5.entry.js} +18 -87
  162. package/dist/genexus-ide-ui/p-658755d5.entry.js.map +1 -0
  163. package/dist/genexus-ide-ui/{p-278afab1.entry.js → p-6abe5291.entry.js} +2 -2
  164. package/dist/genexus-ide-ui/p-7a2d3f1c.entry.js +304 -0
  165. package/dist/genexus-ide-ui/p-7a2d3f1c.entry.js.map +1 -0
  166. package/dist/genexus-ide-ui/p-7ec19ed6.entry.js +73 -0
  167. package/dist/genexus-ide-ui/p-7ec19ed6.entry.js.map +1 -0
  168. package/dist/genexus-ide-ui/{p-4ce0a85e.entry.js → p-ac670f62.entry.js} +2 -2
  169. package/dist/genexus-ide-ui/{p-41ea711a.js → p-b8624c0b.js} +2 -2
  170. package/dist/genexus-ide-ui/p-b8624c0b.js.map +1 -0
  171. package/dist/genexus-ide-ui/{p-066028bc.js → p-c339f703.js} +14 -8
  172. package/dist/{cjs/helpers-19194a5a.js.map → genexus-ide-ui/p-c339f703.js.map} +1 -1
  173. package/dist/genexus-ide-ui/p-c8b4f34c.entry.js +113 -0
  174. package/dist/genexus-ide-ui/p-c8b4f34c.entry.js.map +1 -0
  175. package/dist/genexus-ide-ui/{p-b785673d.entry.js → p-ca8b0024.entry.js} +2 -2
  176. package/dist/genexus-ide-ui/{p-b1f6fdd6.entry.js → p-cf2c8b3c.entry.js} +2 -2
  177. package/dist/genexus-ide-ui/{p-44d779c9.entry.js → p-e8975ac0.entry.js} +2 -2
  178. package/dist/genexus-ide-ui/{p-352d4aad.entry.js → p-f1558097.entry.js} +3 -3
  179. package/dist/types/components/splash/splash.d.ts +20 -0
  180. package/dist/types/components/start-page/start-page.d.ts +31 -53
  181. package/dist/types/components/welcome-page/welcome-page.d.ts +63 -0
  182. package/dist/types/components/ww-images/ww-images.d.ts +118 -98
  183. package/dist/types/components.d.ts +156 -99
  184. package/package.json +6 -3
  185. package/dist/cjs/form-validation-df39cabb.js.map +0 -1
  186. package/dist/cjs/gx-ide-empty-state_2.cjs.entry.js.map +0 -1
  187. package/dist/cjs/gx-ide-recent-news.cjs.entry.js +0 -163
  188. package/dist/cjs/gx-ide-recent-news.cjs.entry.js.map +0 -1
  189. package/dist/collection/components/start-page/gx-ide-assets/recent-news/langs/recent-news.lang.en.json +0 -24
  190. package/dist/collection/components/start-page/gx-ide-assets/recent-news/langs/recent-news.lang.ja.json +0 -24
  191. package/dist/collection/components/start-page/gx-ide-assets/recent-news/langs/recent-news.lang.zh.json +0 -3
  192. package/dist/collection/components/start-page/recent-news.css +0 -641
  193. package/dist/collection/components/start-page/recent-news.js +0 -240
  194. package/dist/collection/components/start-page/recent-news.js.map +0 -1
  195. package/dist/collection/components/ww-images/helpers.js +0 -11
  196. package/dist/collection/components/ww-images/helpers.js.map +0 -1
  197. package/dist/components/gx-ide-recent-news.js +0 -8
  198. package/dist/components/gx-ide-recent-news.js.map +0 -1
  199. package/dist/components/recent-news.js +0 -197
  200. package/dist/components/recent-news.js.map +0 -1
  201. package/dist/esm/form-validation-8b3f527c.js.map +0 -1
  202. package/dist/esm/gx-ide-empty-state_2.entry.js.map +0 -1
  203. package/dist/esm/gx-ide-recent-news.entry.js +0 -159
  204. package/dist/esm/gx-ide-recent-news.entry.js.map +0 -1
  205. package/dist/esm/helpers-9ee6ddce.js.map +0 -1
  206. package/dist/genexus-ide-ui/gx-ide-assets/recent-news/langs/recent-news.lang.en.json +0 -24
  207. package/dist/genexus-ide-ui/gx-ide-assets/recent-news/langs/recent-news.lang.ja.json +0 -24
  208. package/dist/genexus-ide-ui/gx-ide-assets/recent-news/langs/recent-news.lang.zh.json +0 -3
  209. package/dist/genexus-ide-ui/p-0576a392.entry.js +0 -233
  210. package/dist/genexus-ide-ui/p-0576a392.entry.js.map +0 -1
  211. package/dist/genexus-ide-ui/p-066028bc.js.map +0 -1
  212. package/dist/genexus-ide-ui/p-20389960.entry.js +0 -211
  213. package/dist/genexus-ide-ui/p-20389960.entry.js.map +0 -1
  214. package/dist/genexus-ide-ui/p-41ea711a.js.map +0 -1
  215. package/dist/genexus-ide-ui/p-62efd8f2.entry.js +0 -712
  216. package/dist/genexus-ide-ui/p-62efd8f2.entry.js.map +0 -1
  217. package/dist/genexus-ide-ui/p-98b5b178.entry.js.map +0 -1
  218. package/dist/types/components/start-page/recent-news.d.ts +0 -43
  219. package/dist/types/components/ww-images/helpers.d.ts +0 -3
  220. /package/dist/genexus-ide-ui/{p-d5d0ed5e.entry.js.map → p-02bc66c1.entry.js.map} +0 -0
  221. /package/dist/genexus-ide-ui/{p-c4d1d0ce.entry.js.map → p-39792ac8.entry.js.map} +0 -0
  222. /package/dist/genexus-ide-ui/{p-c36effd2.entry.js.map → p-4a0dab98.entry.js.map} +0 -0
  223. /package/dist/genexus-ide-ui/{p-acf0cbac.entry.js.map → p-4ce47bcd.entry.js.map} +0 -0
  224. /package/dist/genexus-ide-ui/{p-fc64d088.entry.js.map → p-58e13823.entry.js.map} +0 -0
  225. /package/dist/genexus-ide-ui/{p-278afab1.entry.js.map → p-6abe5291.entry.js.map} +0 -0
  226. /package/dist/genexus-ide-ui/{p-4ce0a85e.entry.js.map → p-ac670f62.entry.js.map} +0 -0
  227. /package/dist/genexus-ide-ui/{p-b785673d.entry.js.map → p-ca8b0024.entry.js.map} +0 -0
  228. /package/dist/genexus-ide-ui/{p-b1f6fdd6.entry.js.map → p-cf2c8b3c.entry.js.map} +0 -0
  229. /package/dist/genexus-ide-ui/{p-44d779c9.entry.js.map → p-e8975ac0.entry.js.map} +0 -0
  230. /package/dist/genexus-ide-ui/{p-352d4aad.entry.js.map → p-f1558097.entry.js.map} +0 -0
@@ -1,10 +1,2506 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-27c691bc.js';
2
2
  import { g as getIconPath } from './assets-manager-5ac25bb6.js';
3
3
  import { L as Locale } from './locale-3c32f251.js';
4
- import { c as config } from './config-ed1f26d7.js';
5
- import { f as formatDate, h as hiChar } from './helpers-9ee6ddce.js';
6
4
 
7
- const startPageCss = ":root {\n --ui-animaton-speed: 0.2s;\n}\n\n/*ALIGNMENT*/\n/*Ellipsis*/\n/*****************************************************\nTYPOGRAPHY\n*****************************************************/\n/*Title 01 (Positive)*/\n.gxg-title-01 {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-01-font-weight);\n font-size: var(--ds-title-01-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--comfortable);\n color: var(--ds-base-font-color);\n text-align: start;\n line-height: var(--ds-base-font-line-height--comfortable);\n}\n\n/*Title 01 (Negative)*/\n.gxg-title-01--negative {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-01-font-weight);\n font-size: var(--ds-title-01-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--comfortable);\n color: var(--ds-base-font-color);\n text-align: start;\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--negative);\n}\n\n/*Title 02 (Positive)*/\n.gxg-title-02 {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-02-font-weight);\n font-size: var(--ds-title-02-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--regular);\n color: var(--ds-base-font-color);\n text-align: start;\n text-transform: uppercase;\n line-height: var(--ds-base-font-line-height--comfortable);\n}\n\n.gxg-title-02--negative {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-02-font-weight);\n font-size: var(--ds-title-02-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--regular);\n color: var(--ds-base-font-color);\n text-align: start;\n text-transform: uppercase;\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--color-on-primary);\n}\n\n/*Title 03*/\n.gxg-title-03 {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-03-font-weight);\n font-size: var(--ds-title-03-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--regular);\n color: var(--ds-base-font-color);\n text-align: start;\n text-transform: uppercase;\n line-height: var(--ds-base-font-line-height--comfortable);\n}\n\n.gxg-title-03--negative {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-03-font-weight);\n font-size: var(--ds-title-03-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--regular);\n color: var(--ds-base-font-color);\n text-align: start;\n text-transform: uppercase;\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--negative);\n}\n\n/*Title 04*/\n.gxg-title-04 {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-04-font-weight);\n font-size: var(--ds-title-04-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--comfortable);\n color: var(--ds-base-font-color);\n text-align: start;\n line-height: var(--ds-base-font-line-height--comfortable);\n}\n\n.gxg-title-04--negative {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-04-font-weight);\n font-size: var(--ds-title-04-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--comfortable);\n color: var(--ds-base-font-color);\n text-align: start;\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--negative);\n}\n\n/*Title 05*/\n.gxg-title-05 {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-05-font-weight);\n font-size: var(--ds-title-05-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--regular);\n color: var(--ds-base-font-color);\n text-align: start;\n line-height: var(--ds-base-font-line-height--comfortable);\n}\n\n.gxg-title-05--negative {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--ds-title-05-font-weight);\n font-size: var(--ds-title-05-font-size);\n letter-spacing: var(--ds-base-font-letter-spacing--regular);\n color: var(--ds-base-font-color);\n text-align: start;\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--negative);\n}\n\n/*Text*/\n.gxg-text {\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n}\n\n.gxg-text--negative {\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--negative);\n}\n\n.gxg-text--gray {\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--dimmed);\n}\n\n/*Quote*/\n.gxg-quote {\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n font-style: italic;\n}\n\n.gxg-quote--negative {\n color: var(--ds-base-font-color--negative);\n}\n\n/*Link*/\n.gxg-link {\n line-height: unset;\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--link);\n text-decoration: underline;\n cursor: pointer;\n display: inline-block;\n}\n.gxg-link:hover {\n color: var(--ds-base-font-color--link-hover);\n}\n.gxg-link:active {\n color: var(--ds-base-font-color--link-active);\n}\n\n.gxg-link-gray {\n line-height: unset;\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--link);\n text-decoration: underline;\n cursor: pointer;\n display: inline-block;\n color: var(--ds-base-font-color--dimmed);\n}\n.gxg-link-gray:hover {\n line-height: unset;\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--link);\n text-decoration: underline;\n cursor: pointer;\n display: inline-block;\n color: var(--ds-base-font-color--dimmed);\n filter: brightness(1.4);\n}\n\n/*Alerts*/\n.gxg-alert-error {\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--error);\n display: inline-block;\n}\n\n.gxg-alert-warning {\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--warning);\n display: inline-block;\n}\n\n.gxg-alert-success {\n font-family: var(--ds-base-font-family-primary);\n font-size: var(--ds-base-font-size);\n color: var(--ds-base-font-size-color);\n font-weight: var(--ds-base-font-size-weight);\n line-height: var(--ds-base-font-line-height--comfortable);\n color: var(--ds-base-font-color--success);\n display: inline-block;\n}\n\n/*Tab*/\n.gxg-tab--disabled {\n color: var(--color-primary-disabled);\n pointer-events: none;\n}\n.gxg-tab--disabled[disabled] {\n color: var(--color-primary-disabled);\n pointer-events: none;\n}\n\n/*Label*/\n.gxg-label {\n font-family: var(--ds-base-font-family-primary);\n font-weight: var(--gxg-label-font-weight);\n font-size: var(--gxg-label-font-size);\n color: var(--gxg-label-color);\n text-align: center;\n line-height: 1.455em;\n display: flex;\n align-items: center;\n}\n.gxg-label:hover {\n color: var(--color-primary-hover);\n}\n.gxg-label:focus {\n color: var(--color-primary-active);\n}\n.gxg-label:active {\n color: var(--color-primary-active);\n}\n.gxg-label[disabled] {\n color: var(--color-primary-disabled);\n}\n\n.gxg-label--negative {\n color: var(--color-on-primary);\n}\n.gxg-label--negative[disabled] {\n color: var(--color-on-disabled);\n}\n\n/*****************************************************\nGXG-BUTTON and GXG-BUTTON-GROUP COMMON STYLES\n*****************************************************/\n/*****************************************************\nFORM ELEMENTS\n*****************************************************/\n.gxg-scrollbar {\n /* Track */\n /* Handle */\n /* Handle on hover */\n}\n.gxg-scrollbar::-webkit-scrollbar {\n width: var(--gxg-scrollbar-width);\n height: var(--gxg-scrollbar-width);\n}\n.gxg-scrollbar::-webkit-scrollbar-track {\n background-color: var(--gxg-scrollbar-track-background);\n border-radius: var(--gxg-scrollbar-track-border-radius);\n}\n.gxg-scrollbar::-webkit-scrollbar-thumb {\n background-color: var(--gxg-scrollbar-track-thumb-background);\n border-radius: var(--gxg-scrollbar-track-thumb-radius);\n}\n.gxg-scrollbar::-webkit-scrollbar-thumb:hover {\n background-color: var(--gxg-scrollbar-track-thumb-hover-background);\n}\n.gxg-scrollbar::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n\n/*Gx Ide*/\n/*@container queries*/\n/* hiChar styles\nFound on /common/helpers.tsx hiChar function is used to add a span/class to every character that matches a search value. It is used to help the user see why the filter results are filtered. The span/class on the characters are useless without proper styling.\n*/\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n/* - - - - - - - - - - - - - - - - -\nNew classes for Chameleon + Mercury\n- - - - - - - - - - - - - - - - - */\n:host {\n display: grid;\n block-size: 100%;\n}\n\n.card-regular {\n background-color: var(--mer-surface__elevation--01);\n border: var(--mer-border__width--sm) solid var(--mer-border-color__on-elevation--01);\n border-radius: var(--mer-border__radius--md);\n padding: var(--mer-spacing--md) var(--mer-spacing--md);\n display: grid;\n}\n\n.card-small {\n background-color: var(--mer-surface__elevation--02);\n border-radius: var(--mer-border__radius--sm);\n padding: var(--mer-spacing--sm) var(--mer-spacing--sm);\n}\n.card-small--actionable:hover {\n background-color: var(--mer-color__neutral-gray--600);\n}\n.card-small--actionable:active {\n background-color: var(--mer-color__neutral-gray--650);\n}\n.card-small:focus-visible {\n outline: var(--focus__outline-width) var(--focus__outline-style) var(--focus__outline-color);\n outline-offset: var(--focus__outline-offset);\n}\n\n.empty-state {\n block-size: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n gap: var(--mer-spacing--sm);\n text-align: center;\n}\n.empty-state__title, .empty-state__button, .empty-state__link {\n max-inline-size: 300px;\n}\n\n.opacity-0 {\n opacity: 0;\n}\n\n.opacity-1 {\n opacity: 1;\n}\n\n.display-contents {\n display: contents;\n}\n\n/* - - - - - - - - - - - - - - - - - - - \nOld classes (Gemini) to be removed soon\n- - - - - - - - - - - - - - - - - - - */\n/* - - - - - - - - - - - - - - - - - - - \nOld classes (Gemini) to be removed soon\n- - - - - - - - - - - - - - - - - - - */\n/* Helper Classes */\n.gxi-hidden {\n display: none !important;\n}\n\n.gxi-full-height {\n height: 100%;\n}\n\n.gxi-overflow-auto {\n overflow: auto;\n}\n\n.gxi-display-flex {\n display: flex;\n}\n\n.align-start {\n display: flex;\n align-items: start;\n}\n\n.align-center {\n display: flex;\n align-items: center;\n}\n\n.align-end {\n display: flex;\n align-items: end;\n}\n\n.overflow-auto {\n overflow: auto;\n}\n\n.justify-start {\n display: flex;\n justify-content: start;\n}\n\n.justify-center {\n display: flex;\n justify-content: center;\n}\n\n.justify-end {\n display: flex;\n justify-content: end;\n}\n\n/* Grids */\n.grid {\n display: grid;\n grid-row-gap: var(--gx-ide-grid-row-gap);\n grid-column-gap: var(--gx-ide-grid-column-gap);\n grid-template-rows: auto;\n}\n\nch-grid-cell {\n display: flex;\n}\n\nch-grid {\n overflow: auto;\n height: 100%;\n}\n\nch-grid-column {\n /*to be removed when this works inside a component with shadow: true*/\n z-index: 99;\n border-bottom: 1px solid var(--mer-color__neutral-gray--800);\n}\n\nch-grid-column:first-child {\n padding-inline-start: var(--gx-ide-container__padding) !important;\n}\n\nch-grid-column:last-child {\n padding-inline-end: var(--gx-ide-container__padding) !important;\n}\n\nch-grid-cell {\n --mer-spacing--xs: var(--gx-ide-container__padding);\n}\n\n/*--- Layout ---*/\n.layout {\n display: grid;\n gap: var(--mer-spacing--lg);\n box-sizing: border-box;\n}\n.layout--two-cols {\n grid-template-columns: 1fr 1fr;\n}\n.layout--space-above {\n padding-block-start: var(--mer-spacing--lg);\n}\n\n/*Gxg Tabs*/\ngxg-tabs {\n box-shadow: none;\n}\n\n/*All components Host should have this class set. !important is set on every rule, since this styles could be overridden by the host user, since they are applied on the host component*/\n:host(.gx-ide-component) {\n height: 100% !important;\n display: flex !important;\n flex-direction: column !important;\n}\n\n/*stylize the top bar*/\n:host(:focus-within) gx-ide-top-bar::part(wrapper) {\n background-color: var(--color-secondary-enabled);\n}\n\n/* Main wrapper (should be the first element inside the host. Everything should be inside .gx-ide-main-wrapper) */\n.gx-ide-main-wrapper {\n color: var(--gx-ide-component-text-color);\n font-weight: var(--mer-font__weight--regular);\n font-size: var(--mer-font__size--xs);\n font-family: var(--mer-font-family--primary);\n height: 100%;\n background-color: var(--gx-ide-component-background-color);\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n box-sizing: border-box;\n}\n\n/*This is the main element. This is the one that take the remaining vertical space*/\n.gx-ide-main {\n flex-grow: 1;\n overflow-y: auto;\n /* Track */\n /* Handle */\n /* Handle on hover */\n}\n.gx-ide-main::-webkit-scrollbar {\n width: var(--gxg-scrollbar-width);\n height: var(--gxg-scrollbar-width);\n}\n.gx-ide-main::-webkit-scrollbar-track {\n background-color: var(--gxg-scrollbar-track-background);\n border-radius: var(--gxg-scrollbar-track-border-radius);\n}\n.gx-ide-main::-webkit-scrollbar-thumb {\n background-color: var(--gxg-scrollbar-track-thumb-background);\n border-radius: var(--gxg-scrollbar-track-thumb-radius);\n}\n.gx-ide-main::-webkit-scrollbar-thumb:hover {\n background-color: var(--gxg-scrollbar-track-thumb-hover-background);\n}\n.gx-ide-main::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n\n.gx-ide-overflow {\n overflow-y: auto;\n /* Track */\n /* Handle */\n /* Handle on hover */\n}\n.gx-ide-overflow::-webkit-scrollbar {\n width: var(--gxg-scrollbar-width);\n height: var(--gxg-scrollbar-width);\n}\n.gx-ide-overflow::-webkit-scrollbar-track {\n background-color: var(--gxg-scrollbar-track-background);\n border-radius: var(--gxg-scrollbar-track-border-radius);\n}\n.gx-ide-overflow::-webkit-scrollbar-thumb {\n background-color: var(--gxg-scrollbar-track-thumb-background);\n border-radius: var(--gxg-scrollbar-track-thumb-radius);\n}\n.gx-ide-overflow::-webkit-scrollbar-thumb:hover {\n background-color: var(--gxg-scrollbar-track-thumb-hover-background);\n}\n.gx-ide-overflow::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n\n.tree-view-primary {\n font-size: var(--mer-font__size--2xs);\n}\n\np {\n margin: 0;\n font-size: var(--mer-font__size--xxs);\n}\n\n/* - - - - - - - - - - - - - - - - - -\nNew : For Mercury\n- - - - - - - - - - - - - - - - - - */\n.buttons-container {\n display: flex;\n gap: var(--mer-spacing--xs);\n}\n\n/*Gx Ide*/\n/*@container queries*/\n/* hiChar styles\nFound on /common/helpers.tsx hiChar function is used to add a span/class to every character that matches a search value. It is used to help the user see why the filter results are filtered. The span/class on the characters are useless without proper styling.\n*/\n.hiChar {\n color: var(--mer-color__primary--200);\n filter: brightness(1.3);\n}\n\n:host {\n overflow: auto;\n container-type: inline-size;\n container-name: host;\n}\n\n.layout-main,\n.layout__panel {\n block-size: 100%;\n overflow: auto;\n}\n\n@container host (max-width: 768px) {\n .layout.layout-main {\n grid-template-columns: 1fr;\n grid-template-rows: 1fr 1fr;\n }\n}\n.panel-recent-kbs {\n position: relative;\n}\n\n.recent-kbs,\n.recent-news {\n display: grid;\n grid-template-rows: auto 1fr;\n gap: var(--mer-spacing--md);\n overflow: auto;\n}\n.recent-kbs__header,\n.recent-news__header {\n display: grid;\n gap: var(--mer-spacing--md);\n}\n\n.kbs-container {\n display: grid;\n gap: var(--mer-spacing--xs);\n overflow: auto;\n grid-auto-rows: max-content;\n container-type: inline-size;\n container-name: kb-container;\n animation: fadeIn var(--mer-timing--super-fast) forwards linear;\n}\n\n.card-kb {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--mer-spacing--lg);\n container-type: inline-size;\n container-name: card-kb;\n}\n.card-kb__left-col {\n display: flex;\n align-items: center;\n gap: var(--mer-spacing--sm);\n}\n\n@container kb-container (max-width: 360px) {\n .card-kb {\n align-items: center;\n flex-direction: column;\n gap: var(--mer-spacing--xs);\n justify-content: start;\n }\n}\ngx-ide-recent-news {\n overflow: auto;\n}\n\n.panel-recent-news {\n position: relative;\n}\n\n@keyframes exactMatchBright {\n 100% {\n filter: brightness(1.25);\n }\n}\n.exact-match-bright {\n animation: exactMatchBright var(--mer-timing--super-fast) ease-in-out 4 alternate;\n}\n\ngx-ide-loader::part(loader-wrapper) {\n border: var(--mer-border__width--sm) solid var(--mer-border-color__on-elevation--01);\n border-radius: var(--mer-border__radius--md);\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n}";
5
+ /**
6
+ * @module constants
7
+ * @summary Useful constants
8
+ * @description
9
+ * Collection of useful date constants.
10
+ *
11
+ * The constants could be imported from `date-fns/constants`:
12
+ *
13
+ * ```ts
14
+ * import { maxTime, minTime } from "./constants/date-fns/constants";
15
+ *
16
+ * function isAllowedTime(time) {
17
+ * return time <= maxTime && time >= minTime;
18
+ * }
19
+ * ```
20
+ */
21
+
22
+ /**
23
+ * @constant
24
+ * @name minutesInMonth
25
+ * @summary Minutes in 1 month.
26
+ */
27
+ const minutesInMonth = 43200;
28
+
29
+ /**
30
+ * @constant
31
+ * @name minutesInDay
32
+ * @summary Minutes in 1 day.
33
+ */
34
+ const minutesInDay = 1440;
35
+
36
+ /**
37
+ * @constant
38
+ * @name constructFromSymbol
39
+ * @summary Symbol enabling Date extensions to inherit properties from the reference date.
40
+ *
41
+ * The symbol is used to enable the `constructFrom` function to construct a date
42
+ * using a reference date and a value. It allows to transfer extra properties
43
+ * from the reference date to the new date. It's useful for extensions like
44
+ * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
45
+ * a constructor argument.
46
+ */
47
+ const constructFromSymbol = Symbol.for("constructDateFrom");
48
+
49
+ /**
50
+ * @name constructFrom
51
+ * @category Generic Helpers
52
+ * @summary Constructs a date using the reference date and the value
53
+ *
54
+ * @description
55
+ * The function constructs a new date using the constructor from the reference
56
+ * date and the given value. It helps to build generic functions that accept
57
+ * date extensions.
58
+ *
59
+ * It defaults to `Date` if the passed reference date is a number or a string.
60
+ *
61
+ * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
62
+ * enabling to transfer extra properties from the reference date to the new date.
63
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
64
+ * that accept a time zone as a constructor argument.
65
+ *
66
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
67
+ *
68
+ * @param date - The reference date to take constructor from
69
+ * @param value - The value to create the date
70
+ *
71
+ * @returns Date initialized using the given date and value
72
+ *
73
+ * @example
74
+ * import { constructFrom } from "./constructFrom/date-fns";
75
+ *
76
+ * // A function that clones a date preserving the original type
77
+ * function cloneDate<DateType extends Date>(date: DateType): DateType {
78
+ * return constructFrom(
79
+ * date, // Use constructor from the given date
80
+ * date.getTime() // Use the date value to create a new date
81
+ * );
82
+ * }
83
+ */
84
+ function constructFrom(date, value) {
85
+ if (typeof date === "function") return date(value);
86
+
87
+ if (date && typeof date === "object" && constructFromSymbol in date)
88
+ return date[constructFromSymbol](value);
89
+
90
+ if (date instanceof Date) return new date.constructor(value);
91
+
92
+ return new Date(value);
93
+ }
94
+
95
+ /**
96
+ * @name toDate
97
+ * @category Common Helpers
98
+ * @summary Convert the given argument to an instance of Date.
99
+ *
100
+ * @description
101
+ * Convert the given argument to an instance of Date.
102
+ *
103
+ * If the argument is an instance of Date, the function returns its clone.
104
+ *
105
+ * If the argument is a number, it is treated as a timestamp.
106
+ *
107
+ * If the argument is none of the above, the function returns Invalid Date.
108
+ *
109
+ * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
110
+ * enabling to transfer extra properties from the reference date to the new date.
111
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
112
+ * that accept a time zone as a constructor argument.
113
+ *
114
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
115
+ *
116
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
117
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
118
+ *
119
+ * @param argument - The value to convert
120
+ *
121
+ * @returns The parsed date in the local time zone
122
+ *
123
+ * @example
124
+ * // Clone the date:
125
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
126
+ * //=> Tue Feb 11 2014 11:30:30
127
+ *
128
+ * @example
129
+ * // Convert the timestamp to date:
130
+ * const result = toDate(1392098430000)
131
+ * //=> Tue Feb 11 2014 11:30:30
132
+ */
133
+ function toDate(argument, context) {
134
+ // [TODO] Get rid of `toDate` or `constructFrom`?
135
+ return constructFrom(context || argument, argument);
136
+ }
137
+
138
+ let defaultOptions = {};
139
+
140
+ function getDefaultOptions() {
141
+ return defaultOptions;
142
+ }
143
+
144
+ /**
145
+ * The {@link startOfWeek} function options.
146
+ */
147
+
148
+ /**
149
+ * @name startOfWeek
150
+ * @category Week Helpers
151
+ * @summary Return the start of a week for the given date.
152
+ *
153
+ * @description
154
+ * Return the start of a week for the given date.
155
+ * The result will be in the local timezone.
156
+ *
157
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
158
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
159
+ *
160
+ * @param date - The original date
161
+ * @param options - An object with options
162
+ *
163
+ * @returns The start of a week
164
+ *
165
+ * @example
166
+ * // The start of a week for 2 September 2014 11:55:00:
167
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
168
+ * //=> Sun Aug 31 2014 00:00:00
169
+ *
170
+ * @example
171
+ * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
172
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
173
+ * //=> Mon Sep 01 2014 00:00:00
174
+ */
175
+ function startOfWeek(date, options) {
176
+ const defaultOptions = getDefaultOptions();
177
+ const weekStartsOn =
178
+ options?.weekStartsOn ??
179
+ options?.locale?.options?.weekStartsOn ??
180
+ defaultOptions.weekStartsOn ??
181
+ defaultOptions.locale?.options?.weekStartsOn ??
182
+ 0;
183
+
184
+ const _date = toDate(date, options?.in);
185
+ const day = _date.getDay();
186
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
187
+
188
+ _date.setDate(_date.getDate() - diff);
189
+ _date.setHours(0, 0, 0, 0);
190
+ return _date;
191
+ }
192
+
193
+ /**
194
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
195
+ * They usually appear for dates that denote time before the timezones were introduced
196
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
197
+ * and GMT+01:00:00 after that date)
198
+ *
199
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
200
+ * which would lead to incorrect calculations.
201
+ *
202
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
203
+ */
204
+ function getTimezoneOffsetInMilliseconds(date) {
205
+ const _date = toDate(date);
206
+ const utcDate = new Date(
207
+ Date.UTC(
208
+ _date.getFullYear(),
209
+ _date.getMonth(),
210
+ _date.getDate(),
211
+ _date.getHours(),
212
+ _date.getMinutes(),
213
+ _date.getSeconds(),
214
+ _date.getMilliseconds(),
215
+ ),
216
+ );
217
+ utcDate.setUTCFullYear(_date.getFullYear());
218
+ return +date - +utcDate;
219
+ }
220
+
221
+ function normalizeDates(context, ...dates) {
222
+ const normalize = constructFrom.bind(
223
+ null,
224
+ context || dates.find((date) => typeof date === "object"),
225
+ );
226
+ return dates.map(normalize);
227
+ }
228
+
229
+ /**
230
+ * @name compareAsc
231
+ * @category Common Helpers
232
+ * @summary Compare the two dates and return -1, 0 or 1.
233
+ *
234
+ * @description
235
+ * Compare the two dates and return 1 if the first date is after the second,
236
+ * -1 if the first date is before the second or 0 if dates are equal.
237
+ *
238
+ * @param dateLeft - The first date to compare
239
+ * @param dateRight - The second date to compare
240
+ *
241
+ * @returns The result of the comparison
242
+ *
243
+ * @example
244
+ * // Compare 11 February 1987 and 10 July 1989:
245
+ * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
246
+ * //=> -1
247
+ *
248
+ * @example
249
+ * // Sort the array of dates:
250
+ * const result = [
251
+ * new Date(1995, 6, 2),
252
+ * new Date(1987, 1, 11),
253
+ * new Date(1989, 6, 10)
254
+ * ].sort(compareAsc)
255
+ * //=> [
256
+ * // Wed Feb 11 1987 00:00:00,
257
+ * // Mon Jul 10 1989 00:00:00,
258
+ * // Sun Jul 02 1995 00:00:00
259
+ * // ]
260
+ */
261
+ function compareAsc(dateLeft, dateRight) {
262
+ const diff = +toDate(dateLeft) - +toDate(dateRight);
263
+
264
+ if (diff < 0) return -1;
265
+ else if (diff > 0) return 1;
266
+
267
+ // Return 0 if diff is 0; return NaN if diff is NaN
268
+ return diff;
269
+ }
270
+
271
+ /**
272
+ * @name constructNow
273
+ * @category Generic Helpers
274
+ * @summary Constructs a new current date using the passed value constructor.
275
+ * @pure false
276
+ *
277
+ * @description
278
+ * The function constructs a new current date using the constructor from
279
+ * the reference date. It helps to build generic functions that accept date
280
+ * extensions and use the current date.
281
+ *
282
+ * It defaults to `Date` if the passed reference date is a number or a string.
283
+ *
284
+ * @param date - The reference date to take constructor from
285
+ *
286
+ * @returns Current date initialized using the given date constructor
287
+ *
288
+ * @example
289
+ * import { constructNow, isSameDay } from 'date-fns'
290
+ *
291
+ * function isToday<DateType extends Date>(
292
+ * date: DateArg<DateType>,
293
+ * ): boolean {
294
+ * // If we were to use `new Date()` directly, the function would behave
295
+ * // differently in different timezones and return false for the same date.
296
+ * return isSameDay(date, constructNow(date));
297
+ * }
298
+ */
299
+ function constructNow(date) {
300
+ return constructFrom(date, Date.now());
301
+ }
302
+
303
+ /**
304
+ * The {@link differenceInCalendarMonths} function options.
305
+ */
306
+
307
+ /**
308
+ * @name differenceInCalendarMonths
309
+ * @category Month Helpers
310
+ * @summary Get the number of calendar months between the given dates.
311
+ *
312
+ * @description
313
+ * Get the number of calendar months between the given dates.
314
+ *
315
+ * @param laterDate - The later date
316
+ * @param earlierDate - The earlier date
317
+ * @param options - An object with options
318
+ *
319
+ * @returns The number of calendar months
320
+ *
321
+ * @example
322
+ * // How many calendar months are between 31 January 2014 and 1 September 2014?
323
+ * const result = differenceInCalendarMonths(
324
+ * new Date(2014, 8, 1),
325
+ * new Date(2014, 0, 31)
326
+ * )
327
+ * //=> 8
328
+ */
329
+ function differenceInCalendarMonths(laterDate, earlierDate, options) {
330
+ const [laterDate_, earlierDate_] = normalizeDates(
331
+ options?.in,
332
+ laterDate,
333
+ earlierDate,
334
+ );
335
+
336
+ const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
337
+ const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
338
+
339
+ return yearsDiff * 12 + monthsDiff;
340
+ }
341
+
342
+ function getRoundingMethod(method) {
343
+ return (number) => {
344
+ const round = method ? Math[method] : Math.trunc;
345
+ const result = round(number);
346
+ // Prevent negative zero
347
+ return result === 0 ? 0 : result;
348
+ };
349
+ }
350
+
351
+ /**
352
+ * @name differenceInMilliseconds
353
+ * @category Millisecond Helpers
354
+ * @summary Get the number of milliseconds between the given dates.
355
+ *
356
+ * @description
357
+ * Get the number of milliseconds between the given dates.
358
+ *
359
+ * @param laterDate - The later date
360
+ * @param earlierDate - The earlier date
361
+ *
362
+ * @returns The number of milliseconds
363
+ *
364
+ * @example
365
+ * // How many milliseconds are between
366
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
367
+ * const result = differenceInMilliseconds(
368
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
369
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
370
+ * )
371
+ * //=> 1100
372
+ */
373
+ function differenceInMilliseconds(laterDate, earlierDate) {
374
+ return +toDate(laterDate) - +toDate(earlierDate);
375
+ }
376
+
377
+ /**
378
+ * The {@link endOfDay} function options.
379
+ */
380
+
381
+ /**
382
+ * @name endOfDay
383
+ * @category Day Helpers
384
+ * @summary Return the end of a day for the given date.
385
+ *
386
+ * @description
387
+ * Return the end of a day for the given date.
388
+ * The result will be in the local timezone.
389
+ *
390
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
391
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
392
+ *
393
+ * @param date - The original date
394
+ * @param options - An object with options
395
+ *
396
+ * @returns The end of a day
397
+ *
398
+ * @example
399
+ * // The end of a day for 2 September 2014 11:55:00:
400
+ * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
401
+ * //=> Tue Sep 02 2014 23:59:59.999
402
+ */
403
+ function endOfDay(date, options) {
404
+ const _date = toDate(date, options?.in);
405
+ _date.setHours(23, 59, 59, 999);
406
+ return _date;
407
+ }
408
+
409
+ /**
410
+ * The {@link endOfMonth} function options.
411
+ */
412
+
413
+ /**
414
+ * @name endOfMonth
415
+ * @category Month Helpers
416
+ * @summary Return the end of a month for the given date.
417
+ *
418
+ * @description
419
+ * Return the end of a month for the given date.
420
+ * The result will be in the local timezone.
421
+ *
422
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
423
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
424
+ *
425
+ * @param date - The original date
426
+ * @param options - An object with options
427
+ *
428
+ * @returns The end of a month
429
+ *
430
+ * @example
431
+ * // The end of a month for 2 September 2014 11:55:00:
432
+ * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
433
+ * //=> Tue Sep 30 2014 23:59:59.999
434
+ */
435
+ function endOfMonth(date, options) {
436
+ const _date = toDate(date, options?.in);
437
+ const month = _date.getMonth();
438
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
439
+ _date.setHours(23, 59, 59, 999);
440
+ return _date;
441
+ }
442
+
443
+ /**
444
+ * @name isLastDayOfMonth
445
+ * @category Month Helpers
446
+ * @summary Is the given date the last day of a month?
447
+ *
448
+ * @description
449
+ * Is the given date the last day of a month?
450
+ *
451
+ * @param date - The date to check
452
+ * @param options - An object with options
453
+ *
454
+ * @returns The date is the last day of a month
455
+ *
456
+ * @example
457
+ * // Is 28 February 2014 the last day of a month?
458
+ * const result = isLastDayOfMonth(new Date(2014, 1, 28))
459
+ * //=> true
460
+ */
461
+ function isLastDayOfMonth(date, options) {
462
+ const _date = toDate(date, options?.in);
463
+ return +endOfDay(_date, options) === +endOfMonth(_date, options);
464
+ }
465
+
466
+ /**
467
+ * The {@link differenceInMonths} function options.
468
+ */
469
+
470
+ /**
471
+ * @name differenceInMonths
472
+ * @category Month Helpers
473
+ * @summary Get the number of full months between the given dates.
474
+ *
475
+ * @param laterDate - The later date
476
+ * @param earlierDate - The earlier date
477
+ * @param options - An object with options
478
+ *
479
+ * @returns The number of full months
480
+ *
481
+ * @example
482
+ * // How many full months are between 31 January 2014 and 1 September 2014?
483
+ * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
484
+ * //=> 7
485
+ */
486
+ function differenceInMonths(laterDate, earlierDate, options) {
487
+ const [laterDate_, workingLaterDate, earlierDate_] = normalizeDates(
488
+ options?.in,
489
+ laterDate,
490
+ laterDate,
491
+ earlierDate,
492
+ );
493
+
494
+ const sign = compareAsc(workingLaterDate, earlierDate_);
495
+ const difference = Math.abs(
496
+ differenceInCalendarMonths(workingLaterDate, earlierDate_),
497
+ );
498
+
499
+ if (difference < 1) return 0;
500
+
501
+ if (workingLaterDate.getMonth() === 1 && workingLaterDate.getDate() > 27)
502
+ workingLaterDate.setDate(30);
503
+
504
+ workingLaterDate.setMonth(workingLaterDate.getMonth() - sign * difference);
505
+
506
+ let isLastMonthNotFull = compareAsc(workingLaterDate, earlierDate_) === -sign;
507
+
508
+ if (
509
+ isLastDayOfMonth(laterDate_) &&
510
+ difference === 1 &&
511
+ compareAsc(laterDate_, earlierDate_) === 1
512
+ ) {
513
+ isLastMonthNotFull = false;
514
+ }
515
+
516
+ const result = sign * (difference - +isLastMonthNotFull);
517
+ return result === 0 ? 0 : result;
518
+ }
519
+
520
+ /**
521
+ * The {@link differenceInSeconds} function options.
522
+ */
523
+
524
+ /**
525
+ * @name differenceInSeconds
526
+ * @category Second Helpers
527
+ * @summary Get the number of seconds between the given dates.
528
+ *
529
+ * @description
530
+ * Get the number of seconds between the given dates.
531
+ *
532
+ * @param laterDate - The later date
533
+ * @param earlierDate - The earlier date
534
+ * @param options - An object with options.
535
+ *
536
+ * @returns The number of seconds
537
+ *
538
+ * @example
539
+ * // How many seconds are between
540
+ * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
541
+ * const result = differenceInSeconds(
542
+ * new Date(2014, 6, 2, 12, 30, 20, 0),
543
+ * new Date(2014, 6, 2, 12, 30, 7, 999)
544
+ * )
545
+ * //=> 12
546
+ */
547
+ function differenceInSeconds(laterDate, earlierDate, options) {
548
+ const diff = differenceInMilliseconds(laterDate, earlierDate) / 1000;
549
+ return getRoundingMethod(options?.roundingMethod)(diff);
550
+ }
551
+
552
+ const formatDistanceLocale$2 = {
553
+ lessThanXSeconds: {
554
+ one: "less than a second",
555
+ other: "less than {{count}} seconds",
556
+ },
557
+
558
+ xSeconds: {
559
+ one: "1 second",
560
+ other: "{{count}} seconds",
561
+ },
562
+
563
+ halfAMinute: "half a minute",
564
+
565
+ lessThanXMinutes: {
566
+ one: "less than a minute",
567
+ other: "less than {{count}} minutes",
568
+ },
569
+
570
+ xMinutes: {
571
+ one: "1 minute",
572
+ other: "{{count}} minutes",
573
+ },
574
+
575
+ aboutXHours: {
576
+ one: "about 1 hour",
577
+ other: "about {{count}} hours",
578
+ },
579
+
580
+ xHours: {
581
+ one: "1 hour",
582
+ other: "{{count}} hours",
583
+ },
584
+
585
+ xDays: {
586
+ one: "1 day",
587
+ other: "{{count}} days",
588
+ },
589
+
590
+ aboutXWeeks: {
591
+ one: "about 1 week",
592
+ other: "about {{count}} weeks",
593
+ },
594
+
595
+ xWeeks: {
596
+ one: "1 week",
597
+ other: "{{count}} weeks",
598
+ },
599
+
600
+ aboutXMonths: {
601
+ one: "about 1 month",
602
+ other: "about {{count}} months",
603
+ },
604
+
605
+ xMonths: {
606
+ one: "1 month",
607
+ other: "{{count}} months",
608
+ },
609
+
610
+ aboutXYears: {
611
+ one: "about 1 year",
612
+ other: "about {{count}} years",
613
+ },
614
+
615
+ xYears: {
616
+ one: "1 year",
617
+ other: "{{count}} years",
618
+ },
619
+
620
+ overXYears: {
621
+ one: "over 1 year",
622
+ other: "over {{count}} years",
623
+ },
624
+
625
+ almostXYears: {
626
+ one: "almost 1 year",
627
+ other: "almost {{count}} years",
628
+ },
629
+ };
630
+
631
+ const formatDistance$3 = (token, count, options) => {
632
+ let result;
633
+
634
+ const tokenValue = formatDistanceLocale$2[token];
635
+ if (typeof tokenValue === "string") {
636
+ result = tokenValue;
637
+ } else if (count === 1) {
638
+ result = tokenValue.one;
639
+ } else {
640
+ result = tokenValue.other.replace("{{count}}", count.toString());
641
+ }
642
+
643
+ if (options?.addSuffix) {
644
+ if (options.comparison && options.comparison > 0) {
645
+ return "in " + result;
646
+ } else {
647
+ return result + " ago";
648
+ }
649
+ }
650
+
651
+ return result;
652
+ };
653
+
654
+ function buildFormatLongFn(args) {
655
+ return (options = {}) => {
656
+ // TODO: Remove String()
657
+ const width = options.width ? String(options.width) : args.defaultWidth;
658
+ const format = args.formats[width] || args.formats[args.defaultWidth];
659
+ return format;
660
+ };
661
+ }
662
+
663
+ const dateFormats$2 = {
664
+ full: "EEEE, MMMM do, y",
665
+ long: "MMMM do, y",
666
+ medium: "MMM d, y",
667
+ short: "MM/dd/yyyy",
668
+ };
669
+
670
+ const timeFormats$2 = {
671
+ full: "h:mm:ss a zzzz",
672
+ long: "h:mm:ss a z",
673
+ medium: "h:mm:ss a",
674
+ short: "h:mm a",
675
+ };
676
+
677
+ const dateTimeFormats$2 = {
678
+ full: "{{date}} 'at' {{time}}",
679
+ long: "{{date}} 'at' {{time}}",
680
+ medium: "{{date}}, {{time}}",
681
+ short: "{{date}}, {{time}}",
682
+ };
683
+
684
+ const formatLong$2 = {
685
+ date: buildFormatLongFn({
686
+ formats: dateFormats$2,
687
+ defaultWidth: "full",
688
+ }),
689
+
690
+ time: buildFormatLongFn({
691
+ formats: timeFormats$2,
692
+ defaultWidth: "full",
693
+ }),
694
+
695
+ dateTime: buildFormatLongFn({
696
+ formats: dateTimeFormats$2,
697
+ defaultWidth: "full",
698
+ }),
699
+ };
700
+
701
+ const formatRelativeLocale$2 = {
702
+ lastWeek: "'last' eeee 'at' p",
703
+ yesterday: "'yesterday at' p",
704
+ today: "'today at' p",
705
+ tomorrow: "'tomorrow at' p",
706
+ nextWeek: "eeee 'at' p",
707
+ other: "P",
708
+ };
709
+
710
+ const formatRelative$2 = (token, _date, _baseDate, _options) =>
711
+ formatRelativeLocale$2[token];
712
+
713
+ /**
714
+ * The localize function argument callback which allows to convert raw value to
715
+ * the actual type.
716
+ *
717
+ * @param value - The value to convert
718
+ *
719
+ * @returns The converted value
720
+ */
721
+
722
+ /**
723
+ * The map of localized values for each width.
724
+ */
725
+
726
+ /**
727
+ * The index type of the locale unit value. It types conversion of units of
728
+ * values that don't start at 0 (i.e. quarters).
729
+ */
730
+
731
+ /**
732
+ * Converts the unit value to the tuple of values.
733
+ */
734
+
735
+ /**
736
+ * The tuple of localized era values. The first element represents BC,
737
+ * the second element represents AD.
738
+ */
739
+
740
+ /**
741
+ * The tuple of localized quarter values. The first element represents Q1.
742
+ */
743
+
744
+ /**
745
+ * The tuple of localized day values. The first element represents Sunday.
746
+ */
747
+
748
+ /**
749
+ * The tuple of localized month values. The first element represents January.
750
+ */
751
+
752
+ function buildLocalizeFn(args) {
753
+ return (value, options) => {
754
+ const context = options?.context ? String(options.context) : "standalone";
755
+
756
+ let valuesArray;
757
+ if (context === "formatting" && args.formattingValues) {
758
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
759
+ const width = options?.width ? String(options.width) : defaultWidth;
760
+
761
+ valuesArray =
762
+ args.formattingValues[width] || args.formattingValues[defaultWidth];
763
+ } else {
764
+ const defaultWidth = args.defaultWidth;
765
+ const width = options?.width ? String(options.width) : args.defaultWidth;
766
+
767
+ valuesArray = args.values[width] || args.values[defaultWidth];
768
+ }
769
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
770
+
771
+ // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
772
+ return valuesArray[index];
773
+ };
774
+ }
775
+
776
+ const eraValues$2 = {
777
+ narrow: ["B", "A"],
778
+ abbreviated: ["BC", "AD"],
779
+ wide: ["Before Christ", "Anno Domini"],
780
+ };
781
+
782
+ const quarterValues$2 = {
783
+ narrow: ["1", "2", "3", "4"],
784
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
785
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
786
+ };
787
+
788
+ // Note: in English, the names of days of the week and months are capitalized.
789
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
790
+ // Generally, formatted dates should look like they are in the middle of a sentence,
791
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
792
+ const monthValues$2 = {
793
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
794
+ abbreviated: [
795
+ "Jan",
796
+ "Feb",
797
+ "Mar",
798
+ "Apr",
799
+ "May",
800
+ "Jun",
801
+ "Jul",
802
+ "Aug",
803
+ "Sep",
804
+ "Oct",
805
+ "Nov",
806
+ "Dec",
807
+ ],
808
+
809
+ wide: [
810
+ "January",
811
+ "February",
812
+ "March",
813
+ "April",
814
+ "May",
815
+ "June",
816
+ "July",
817
+ "August",
818
+ "September",
819
+ "October",
820
+ "November",
821
+ "December",
822
+ ],
823
+ };
824
+
825
+ const dayValues$2 = {
826
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
827
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
828
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
829
+ wide: [
830
+ "Sunday",
831
+ "Monday",
832
+ "Tuesday",
833
+ "Wednesday",
834
+ "Thursday",
835
+ "Friday",
836
+ "Saturday",
837
+ ],
838
+ };
839
+
840
+ const dayPeriodValues$2 = {
841
+ narrow: {
842
+ am: "a",
843
+ pm: "p",
844
+ midnight: "mi",
845
+ noon: "n",
846
+ morning: "morning",
847
+ afternoon: "afternoon",
848
+ evening: "evening",
849
+ night: "night",
850
+ },
851
+ abbreviated: {
852
+ am: "AM",
853
+ pm: "PM",
854
+ midnight: "midnight",
855
+ noon: "noon",
856
+ morning: "morning",
857
+ afternoon: "afternoon",
858
+ evening: "evening",
859
+ night: "night",
860
+ },
861
+ wide: {
862
+ am: "a.m.",
863
+ pm: "p.m.",
864
+ midnight: "midnight",
865
+ noon: "noon",
866
+ morning: "morning",
867
+ afternoon: "afternoon",
868
+ evening: "evening",
869
+ night: "night",
870
+ },
871
+ };
872
+
873
+ const formattingDayPeriodValues$2 = {
874
+ narrow: {
875
+ am: "a",
876
+ pm: "p",
877
+ midnight: "mi",
878
+ noon: "n",
879
+ morning: "in the morning",
880
+ afternoon: "in the afternoon",
881
+ evening: "in the evening",
882
+ night: "at night",
883
+ },
884
+ abbreviated: {
885
+ am: "AM",
886
+ pm: "PM",
887
+ midnight: "midnight",
888
+ noon: "noon",
889
+ morning: "in the morning",
890
+ afternoon: "in the afternoon",
891
+ evening: "in the evening",
892
+ night: "at night",
893
+ },
894
+ wide: {
895
+ am: "a.m.",
896
+ pm: "p.m.",
897
+ midnight: "midnight",
898
+ noon: "noon",
899
+ morning: "in the morning",
900
+ afternoon: "in the afternoon",
901
+ evening: "in the evening",
902
+ night: "at night",
903
+ },
904
+ };
905
+
906
+ const ordinalNumber$2 = (dirtyNumber, _options) => {
907
+ const number = Number(dirtyNumber);
908
+
909
+ // If ordinal numbers depend on context, for example,
910
+ // if they are different for different grammatical genders,
911
+ // use `options.unit`.
912
+ //
913
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
914
+ // 'day', 'hour', 'minute', 'second'.
915
+
916
+ const rem100 = number % 100;
917
+ if (rem100 > 20 || rem100 < 10) {
918
+ switch (rem100 % 10) {
919
+ case 1:
920
+ return number + "st";
921
+ case 2:
922
+ return number + "nd";
923
+ case 3:
924
+ return number + "rd";
925
+ }
926
+ }
927
+ return number + "th";
928
+ };
929
+
930
+ const localize$2 = {
931
+ ordinalNumber: ordinalNumber$2,
932
+
933
+ era: buildLocalizeFn({
934
+ values: eraValues$2,
935
+ defaultWidth: "wide",
936
+ }),
937
+
938
+ quarter: buildLocalizeFn({
939
+ values: quarterValues$2,
940
+ defaultWidth: "wide",
941
+ argumentCallback: (quarter) => quarter - 1,
942
+ }),
943
+
944
+ month: buildLocalizeFn({
945
+ values: monthValues$2,
946
+ defaultWidth: "wide",
947
+ }),
948
+
949
+ day: buildLocalizeFn({
950
+ values: dayValues$2,
951
+ defaultWidth: "wide",
952
+ }),
953
+
954
+ dayPeriod: buildLocalizeFn({
955
+ values: dayPeriodValues$2,
956
+ defaultWidth: "wide",
957
+ formattingValues: formattingDayPeriodValues$2,
958
+ defaultFormattingWidth: "wide",
959
+ }),
960
+ };
961
+
962
+ function buildMatchFn(args) {
963
+ return (string, options = {}) => {
964
+ const width = options.width;
965
+
966
+ const matchPattern =
967
+ (width && args.matchPatterns[width]) ||
968
+ args.matchPatterns[args.defaultMatchWidth];
969
+ const matchResult = string.match(matchPattern);
970
+
971
+ if (!matchResult) {
972
+ return null;
973
+ }
974
+ const matchedString = matchResult[0];
975
+
976
+ const parsePatterns =
977
+ (width && args.parsePatterns[width]) ||
978
+ args.parsePatterns[args.defaultParseWidth];
979
+
980
+ const key = Array.isArray(parsePatterns)
981
+ ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
982
+ : // [TODO] -- I challenge you to fix the type
983
+ findKey(parsePatterns, (pattern) => pattern.test(matchedString));
984
+
985
+ let value;
986
+
987
+ value = args.valueCallback ? args.valueCallback(key) : key;
988
+ value = options.valueCallback
989
+ ? // [TODO] -- I challenge you to fix the type
990
+ options.valueCallback(value)
991
+ : value;
992
+
993
+ const rest = string.slice(matchedString.length);
994
+
995
+ return { value, rest };
996
+ };
997
+ }
998
+
999
+ function findKey(object, predicate) {
1000
+ for (const key in object) {
1001
+ if (
1002
+ Object.prototype.hasOwnProperty.call(object, key) &&
1003
+ predicate(object[key])
1004
+ ) {
1005
+ return key;
1006
+ }
1007
+ }
1008
+ return undefined;
1009
+ }
1010
+
1011
+ function findIndex(array, predicate) {
1012
+ for (let key = 0; key < array.length; key++) {
1013
+ if (predicate(array[key])) {
1014
+ return key;
1015
+ }
1016
+ }
1017
+ return undefined;
1018
+ }
1019
+
1020
+ function buildMatchPatternFn(args) {
1021
+ return (string, options = {}) => {
1022
+ const matchResult = string.match(args.matchPattern);
1023
+ if (!matchResult) return null;
1024
+ const matchedString = matchResult[0];
1025
+
1026
+ const parseResult = string.match(args.parsePattern);
1027
+ if (!parseResult) return null;
1028
+ let value = args.valueCallback
1029
+ ? args.valueCallback(parseResult[0])
1030
+ : parseResult[0];
1031
+
1032
+ // [TODO] I challenge you to fix the type
1033
+ value = options.valueCallback ? options.valueCallback(value) : value;
1034
+
1035
+ const rest = string.slice(matchedString.length);
1036
+
1037
+ return { value, rest };
1038
+ };
1039
+ }
1040
+
1041
+ const matchOrdinalNumberPattern$2 = /^(\d+)(th|st|nd|rd)?/i;
1042
+ const parseOrdinalNumberPattern$2 = /\d+/i;
1043
+
1044
+ const matchEraPatterns$2 = {
1045
+ narrow: /^(b|a)/i,
1046
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1047
+ wide: /^(before christ|before common era|anno domini|common era)/i,
1048
+ };
1049
+ const parseEraPatterns$2 = {
1050
+ any: [/^b/i, /^(a|c)/i],
1051
+ };
1052
+
1053
+ const matchQuarterPatterns$2 = {
1054
+ narrow: /^[1234]/i,
1055
+ abbreviated: /^q[1234]/i,
1056
+ wide: /^[1234](th|st|nd|rd)? quarter/i,
1057
+ };
1058
+ const parseQuarterPatterns$2 = {
1059
+ any: [/1/i, /2/i, /3/i, /4/i],
1060
+ };
1061
+
1062
+ const matchMonthPatterns$2 = {
1063
+ narrow: /^[jfmasond]/i,
1064
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1065
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
1066
+ };
1067
+ const parseMonthPatterns$2 = {
1068
+ narrow: [
1069
+ /^j/i,
1070
+ /^f/i,
1071
+ /^m/i,
1072
+ /^a/i,
1073
+ /^m/i,
1074
+ /^j/i,
1075
+ /^j/i,
1076
+ /^a/i,
1077
+ /^s/i,
1078
+ /^o/i,
1079
+ /^n/i,
1080
+ /^d/i,
1081
+ ],
1082
+
1083
+ any: [
1084
+ /^ja/i,
1085
+ /^f/i,
1086
+ /^mar/i,
1087
+ /^ap/i,
1088
+ /^may/i,
1089
+ /^jun/i,
1090
+ /^jul/i,
1091
+ /^au/i,
1092
+ /^s/i,
1093
+ /^o/i,
1094
+ /^n/i,
1095
+ /^d/i,
1096
+ ],
1097
+ };
1098
+
1099
+ const matchDayPatterns$2 = {
1100
+ narrow: /^[smtwf]/i,
1101
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1102
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1103
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
1104
+ };
1105
+ const parseDayPatterns$2 = {
1106
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1107
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
1108
+ };
1109
+
1110
+ const matchDayPeriodPatterns$2 = {
1111
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1112
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
1113
+ };
1114
+ const parseDayPeriodPatterns$2 = {
1115
+ any: {
1116
+ am: /^a/i,
1117
+ pm: /^p/i,
1118
+ midnight: /^mi/i,
1119
+ noon: /^no/i,
1120
+ morning: /morning/i,
1121
+ afternoon: /afternoon/i,
1122
+ evening: /evening/i,
1123
+ night: /night/i,
1124
+ },
1125
+ };
1126
+
1127
+ const match$2 = {
1128
+ ordinalNumber: buildMatchPatternFn({
1129
+ matchPattern: matchOrdinalNumberPattern$2,
1130
+ parsePattern: parseOrdinalNumberPattern$2,
1131
+ valueCallback: (value) => parseInt(value, 10),
1132
+ }),
1133
+
1134
+ era: buildMatchFn({
1135
+ matchPatterns: matchEraPatterns$2,
1136
+ defaultMatchWidth: "wide",
1137
+ parsePatterns: parseEraPatterns$2,
1138
+ defaultParseWidth: "any",
1139
+ }),
1140
+
1141
+ quarter: buildMatchFn({
1142
+ matchPatterns: matchQuarterPatterns$2,
1143
+ defaultMatchWidth: "wide",
1144
+ parsePatterns: parseQuarterPatterns$2,
1145
+ defaultParseWidth: "any",
1146
+ valueCallback: (index) => index + 1,
1147
+ }),
1148
+
1149
+ month: buildMatchFn({
1150
+ matchPatterns: matchMonthPatterns$2,
1151
+ defaultMatchWidth: "wide",
1152
+ parsePatterns: parseMonthPatterns$2,
1153
+ defaultParseWidth: "any",
1154
+ }),
1155
+
1156
+ day: buildMatchFn({
1157
+ matchPatterns: matchDayPatterns$2,
1158
+ defaultMatchWidth: "wide",
1159
+ parsePatterns: parseDayPatterns$2,
1160
+ defaultParseWidth: "any",
1161
+ }),
1162
+
1163
+ dayPeriod: buildMatchFn({
1164
+ matchPatterns: matchDayPeriodPatterns$2,
1165
+ defaultMatchWidth: "any",
1166
+ parsePatterns: parseDayPeriodPatterns$2,
1167
+ defaultParseWidth: "any",
1168
+ }),
1169
+ };
1170
+
1171
+ /**
1172
+ * @category Locales
1173
+ * @summary English locale (United States).
1174
+ * @language English
1175
+ * @iso-639-2 eng
1176
+ * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
1177
+ * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
1178
+ */
1179
+ const enUS = {
1180
+ code: "en-US",
1181
+ formatDistance: formatDistance$3,
1182
+ formatLong: formatLong$2,
1183
+ formatRelative: formatRelative$2,
1184
+ localize: localize$2,
1185
+ match: match$2,
1186
+ options: {
1187
+ weekStartsOn: 0 /* Sunday */,
1188
+ firstWeekContainsDate: 1,
1189
+ },
1190
+ };
1191
+
1192
+ /**
1193
+ * The {@link formatDistance} function options.
1194
+ */
1195
+
1196
+ /**
1197
+ * @name formatDistance
1198
+ * @category Common Helpers
1199
+ * @summary Return the distance between the given dates in words.
1200
+ *
1201
+ * @description
1202
+ * Return the distance between the given dates in words.
1203
+ *
1204
+ * | Distance between dates | Result |
1205
+ * |-------------------------------------------------------------------|---------------------|
1206
+ * | 0 ... 30 secs | less than a minute |
1207
+ * | 30 secs ... 1 min 30 secs | 1 minute |
1208
+ * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
1209
+ * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
1210
+ * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
1211
+ * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
1212
+ * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
1213
+ * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
1214
+ * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
1215
+ * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
1216
+ * | 1 yr ... 1 yr 3 months | about 1 year |
1217
+ * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
1218
+ * | 1 yr 9 months ... 2 yrs | almost 2 years |
1219
+ * | N yrs ... N yrs 3 months | about N years |
1220
+ * | N yrs 3 months ... N yrs 9 months | over N years |
1221
+ * | N yrs 9 months ... N+1 yrs | almost N+1 years |
1222
+ *
1223
+ * With `options.includeSeconds == true`:
1224
+ * | Distance between dates | Result |
1225
+ * |------------------------|----------------------|
1226
+ * | 0 secs ... 5 secs | less than 5 seconds |
1227
+ * | 5 secs ... 10 secs | less than 10 seconds |
1228
+ * | 10 secs ... 20 secs | less than 20 seconds |
1229
+ * | 20 secs ... 40 secs | half a minute |
1230
+ * | 40 secs ... 60 secs | less than a minute |
1231
+ * | 60 secs ... 90 secs | 1 minute |
1232
+ *
1233
+ * @param laterDate - The date
1234
+ * @param earlierDate - The date to compare with
1235
+ * @param options - An object with options
1236
+ *
1237
+ * @returns The distance in words
1238
+ *
1239
+ * @throws `date` must not be Invalid Date
1240
+ * @throws `baseDate` must not be Invalid Date
1241
+ * @throws `options.locale` must contain `formatDistance` property
1242
+ *
1243
+ * @example
1244
+ * // What is the distance between 2 July 2014 and 1 January 2015?
1245
+ * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))
1246
+ * //=> '6 months'
1247
+ *
1248
+ * @example
1249
+ * // What is the distance between 1 January 2015 00:00:15
1250
+ * // and 1 January 2015 00:00:00, including seconds?
1251
+ * const result = formatDistance(
1252
+ * new Date(2015, 0, 1, 0, 0, 15),
1253
+ * new Date(2015, 0, 1, 0, 0, 0),
1254
+ * { includeSeconds: true }
1255
+ * )
1256
+ * //=> 'less than 20 seconds'
1257
+ *
1258
+ * @example
1259
+ * // What is the distance from 1 January 2016
1260
+ * // to 1 January 2015, with a suffix?
1261
+ * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {
1262
+ * addSuffix: true
1263
+ * })
1264
+ * //=> 'about 1 year ago'
1265
+ *
1266
+ * @example
1267
+ * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
1268
+ * import { eoLocale } from 'date-fns/locale/eo'
1269
+ * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {
1270
+ * locale: eoLocale
1271
+ * })
1272
+ * //=> 'pli ol 1 jaro'
1273
+ */
1274
+ function formatDistance$2(laterDate, earlierDate, options) {
1275
+ const defaultOptions = getDefaultOptions();
1276
+ const locale = options?.locale ?? defaultOptions.locale ?? enUS;
1277
+ const minutesInAlmostTwoDays = 2520;
1278
+
1279
+ const comparison = compareAsc(laterDate, earlierDate);
1280
+
1281
+ if (isNaN(comparison)) throw new RangeError("Invalid time value");
1282
+
1283
+ const localizeOptions = Object.assign({}, options, {
1284
+ addSuffix: options?.addSuffix,
1285
+ comparison: comparison,
1286
+ });
1287
+
1288
+ const [laterDate_, earlierDate_] = normalizeDates(
1289
+ options?.in,
1290
+ ...(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]),
1291
+ );
1292
+
1293
+ const seconds = differenceInSeconds(earlierDate_, laterDate_);
1294
+ const offsetInSeconds =
1295
+ (getTimezoneOffsetInMilliseconds(earlierDate_) -
1296
+ getTimezoneOffsetInMilliseconds(laterDate_)) /
1297
+ 1000;
1298
+ const minutes = Math.round((seconds - offsetInSeconds) / 60);
1299
+ let months;
1300
+
1301
+ // 0 up to 2 mins
1302
+ if (minutes < 2) {
1303
+ if (options?.includeSeconds) {
1304
+ if (seconds < 5) {
1305
+ return locale.formatDistance("lessThanXSeconds", 5, localizeOptions);
1306
+ } else if (seconds < 10) {
1307
+ return locale.formatDistance("lessThanXSeconds", 10, localizeOptions);
1308
+ } else if (seconds < 20) {
1309
+ return locale.formatDistance("lessThanXSeconds", 20, localizeOptions);
1310
+ } else if (seconds < 40) {
1311
+ return locale.formatDistance("halfAMinute", 0, localizeOptions);
1312
+ } else if (seconds < 60) {
1313
+ return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
1314
+ } else {
1315
+ return locale.formatDistance("xMinutes", 1, localizeOptions);
1316
+ }
1317
+ } else {
1318
+ if (minutes === 0) {
1319
+ return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
1320
+ } else {
1321
+ return locale.formatDistance("xMinutes", minutes, localizeOptions);
1322
+ }
1323
+ }
1324
+
1325
+ // 2 mins up to 0.75 hrs
1326
+ } else if (minutes < 45) {
1327
+ return locale.formatDistance("xMinutes", minutes, localizeOptions);
1328
+
1329
+ // 0.75 hrs up to 1.5 hrs
1330
+ } else if (minutes < 90) {
1331
+ return locale.formatDistance("aboutXHours", 1, localizeOptions);
1332
+
1333
+ // 1.5 hrs up to 24 hrs
1334
+ } else if (minutes < minutesInDay) {
1335
+ const hours = Math.round(minutes / 60);
1336
+ return locale.formatDistance("aboutXHours", hours, localizeOptions);
1337
+
1338
+ // 1 day up to 1.75 days
1339
+ } else if (minutes < minutesInAlmostTwoDays) {
1340
+ return locale.formatDistance("xDays", 1, localizeOptions);
1341
+
1342
+ // 1.75 days up to 30 days
1343
+ } else if (minutes < minutesInMonth) {
1344
+ const days = Math.round(minutes / minutesInDay);
1345
+ return locale.formatDistance("xDays", days, localizeOptions);
1346
+
1347
+ // 1 month up to 2 months
1348
+ } else if (minutes < minutesInMonth * 2) {
1349
+ months = Math.round(minutes / minutesInMonth);
1350
+ return locale.formatDistance("aboutXMonths", months, localizeOptions);
1351
+ }
1352
+
1353
+ months = differenceInMonths(earlierDate_, laterDate_);
1354
+
1355
+ // 2 months up to 12 months
1356
+ if (months < 12) {
1357
+ const nearestMonth = Math.round(minutes / minutesInMonth);
1358
+ return locale.formatDistance("xMonths", nearestMonth, localizeOptions);
1359
+
1360
+ // 1 year up to max Date
1361
+ } else {
1362
+ const monthsSinceStartOfYear = months % 12;
1363
+ const years = Math.trunc(months / 12);
1364
+
1365
+ // N years up to 1 years 3 months
1366
+ if (monthsSinceStartOfYear < 3) {
1367
+ return locale.formatDistance("aboutXYears", years, localizeOptions);
1368
+
1369
+ // N years 3 months up to N years 9 months
1370
+ } else if (monthsSinceStartOfYear < 9) {
1371
+ return locale.formatDistance("overXYears", years, localizeOptions);
1372
+
1373
+ // N years 9 months up to N year 12 months
1374
+ } else {
1375
+ return locale.formatDistance("almostXYears", years + 1, localizeOptions);
1376
+ }
1377
+ }
1378
+ }
1379
+
1380
+ /**
1381
+ * The {@link formatDistanceToNow} function options.
1382
+ */
1383
+
1384
+ /**
1385
+ * @name formatDistanceToNow
1386
+ * @category Common Helpers
1387
+ * @summary Return the distance between the given date and now in words.
1388
+ * @pure false
1389
+ *
1390
+ * @description
1391
+ * Return the distance between the given date and now in words.
1392
+ *
1393
+ * | Distance to now | Result |
1394
+ * |-------------------------------------------------------------------|---------------------|
1395
+ * | 0 ... 30 secs | less than a minute |
1396
+ * | 30 secs ... 1 min 30 secs | 1 minute |
1397
+ * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
1398
+ * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
1399
+ * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
1400
+ * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
1401
+ * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
1402
+ * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
1403
+ * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
1404
+ * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
1405
+ * | 1 yr ... 1 yr 3 months | about 1 year |
1406
+ * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
1407
+ * | 1 yr 9 months ... 2 yrs | almost 2 years |
1408
+ * | N yrs ... N yrs 3 months | about N years |
1409
+ * | N yrs 3 months ... N yrs 9 months | over N years |
1410
+ * | N yrs 9 months ... N+1 yrs | almost N+1 years |
1411
+ *
1412
+ * With `options.includeSeconds == true`:
1413
+ * | Distance to now | Result |
1414
+ * |---------------------|----------------------|
1415
+ * | 0 secs ... 5 secs | less than 5 seconds |
1416
+ * | 5 secs ... 10 secs | less than 10 seconds |
1417
+ * | 10 secs ... 20 secs | less than 20 seconds |
1418
+ * | 20 secs ... 40 secs | half a minute |
1419
+ * | 40 secs ... 60 secs | less than a minute |
1420
+ * | 60 secs ... 90 secs | 1 minute |
1421
+ *
1422
+ * @param date - The given date
1423
+ * @param options - The object with options
1424
+ *
1425
+ * @returns The distance in words
1426
+ *
1427
+ * @throws `date` must not be Invalid Date
1428
+ * @throws `options.locale` must contain `formatDistance` property
1429
+ *
1430
+ * @example
1431
+ * // If today is 1 January 2015, what is the distance to 2 July 2014?
1432
+ * const result = formatDistanceToNow(
1433
+ * new Date(2014, 6, 2)
1434
+ * )
1435
+ * //=> '6 months'
1436
+ *
1437
+ * @example
1438
+ * // If now is 1 January 2015 00:00:00,
1439
+ * // what is the distance to 1 January 2015 00:00:15, including seconds?
1440
+ * const result = formatDistanceToNow(
1441
+ * new Date(2015, 0, 1, 0, 0, 15),
1442
+ * {includeSeconds: true}
1443
+ * )
1444
+ * //=> 'less than 20 seconds'
1445
+ *
1446
+ * @example
1447
+ * // If today is 1 January 2015,
1448
+ * // what is the distance to 1 January 2016, with a suffix?
1449
+ * const result = formatDistanceToNow(
1450
+ * new Date(2016, 0, 1),
1451
+ * {addSuffix: true}
1452
+ * )
1453
+ * //=> 'in about 1 year'
1454
+ *
1455
+ * @example
1456
+ * // If today is 1 January 2015,
1457
+ * // what is the distance to 1 August 2016 in Esperanto?
1458
+ * const eoLocale = require('date-fns/locale/eo')
1459
+ * const result = formatDistanceToNow(
1460
+ * new Date(2016, 7, 1),
1461
+ * {locale: eoLocale}
1462
+ * )
1463
+ * //=> 'pli ol 1 jaro'
1464
+ */
1465
+ function formatDistanceToNow(date, options) {
1466
+ return formatDistance$2(date, constructNow(date), options);
1467
+ }
1468
+
1469
+ /**
1470
+ * The {@link isSameWeek} function options.
1471
+ */
1472
+
1473
+ /**
1474
+ * @name isSameWeek
1475
+ * @category Week Helpers
1476
+ * @summary Are the given dates in the same week (and month and year)?
1477
+ *
1478
+ * @description
1479
+ * Are the given dates in the same week (and month and year)?
1480
+ *
1481
+ * @param laterDate - The first date to check
1482
+ * @param earlierDate - The second date to check
1483
+ * @param options - An object with options
1484
+ *
1485
+ * @returns The dates are in the same week (and month and year)
1486
+ *
1487
+ * @example
1488
+ * // Are 31 August 2014 and 4 September 2014 in the same week?
1489
+ * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4))
1490
+ * //=> true
1491
+ *
1492
+ * @example
1493
+ * // If week starts with Monday,
1494
+ * // are 31 August 2014 and 4 September 2014 in the same week?
1495
+ * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), {
1496
+ * weekStartsOn: 1
1497
+ * })
1498
+ * //=> false
1499
+ *
1500
+ * @example
1501
+ * // Are 1 January 2014 and 1 January 2015 in the same week?
1502
+ * const result = isSameWeek(new Date(2014, 0, 1), new Date(2015, 0, 1))
1503
+ * //=> false
1504
+ */
1505
+ function isSameWeek(laterDate, earlierDate, options) {
1506
+ const [laterDate_, earlierDate_] = normalizeDates(
1507
+ options?.in,
1508
+ laterDate,
1509
+ earlierDate,
1510
+ );
1511
+ return (
1512
+ +startOfWeek(laterDate_, options) === +startOfWeek(earlierDate_, options)
1513
+ );
1514
+ }
1515
+
1516
+ const formatDistanceLocale$1 = {
1517
+ lessThanXSeconds: {
1518
+ one: "1秒未満",
1519
+ other: "{{count}}秒未満",
1520
+ oneWithSuffix: "約1秒",
1521
+ otherWithSuffix: "約{{count}}秒",
1522
+ },
1523
+
1524
+ xSeconds: {
1525
+ one: "1秒",
1526
+ other: "{{count}}秒",
1527
+ },
1528
+
1529
+ halfAMinute: "30秒",
1530
+
1531
+ lessThanXMinutes: {
1532
+ one: "1分未満",
1533
+ other: "{{count}}分未満",
1534
+ oneWithSuffix: "約1分",
1535
+ otherWithSuffix: "約{{count}}分",
1536
+ },
1537
+
1538
+ xMinutes: {
1539
+ one: "1分",
1540
+ other: "{{count}}分",
1541
+ },
1542
+
1543
+ aboutXHours: {
1544
+ one: "約1時間",
1545
+ other: "約{{count}}時間",
1546
+ },
1547
+
1548
+ xHours: {
1549
+ one: "1時間",
1550
+ other: "{{count}}時間",
1551
+ },
1552
+
1553
+ xDays: {
1554
+ one: "1日",
1555
+ other: "{{count}}日",
1556
+ },
1557
+
1558
+ aboutXWeeks: {
1559
+ one: "約1週間",
1560
+ other: "約{{count}}週間",
1561
+ },
1562
+
1563
+ xWeeks: {
1564
+ one: "1週間",
1565
+ other: "{{count}}週間",
1566
+ },
1567
+
1568
+ aboutXMonths: {
1569
+ one: "約1か月",
1570
+ other: "約{{count}}か月",
1571
+ },
1572
+
1573
+ xMonths: {
1574
+ one: "1か月",
1575
+ other: "{{count}}か月",
1576
+ },
1577
+
1578
+ aboutXYears: {
1579
+ one: "約1年",
1580
+ other: "約{{count}}年",
1581
+ },
1582
+
1583
+ xYears: {
1584
+ one: "1年",
1585
+ other: "{{count}}年",
1586
+ },
1587
+
1588
+ overXYears: {
1589
+ one: "1年以上",
1590
+ other: "{{count}}年以上",
1591
+ },
1592
+
1593
+ almostXYears: {
1594
+ one: "1年近く",
1595
+ other: "{{count}}年近く",
1596
+ },
1597
+ };
1598
+
1599
+ const formatDistance$1 = (token, count, options) => {
1600
+ options = options || {};
1601
+
1602
+ let result;
1603
+
1604
+ const tokenValue = formatDistanceLocale$1[token];
1605
+ if (typeof tokenValue === "string") {
1606
+ result = tokenValue;
1607
+ } else if (count === 1) {
1608
+ if (options.addSuffix && tokenValue.oneWithSuffix) {
1609
+ result = tokenValue.oneWithSuffix;
1610
+ } else {
1611
+ result = tokenValue.one;
1612
+ }
1613
+ } else {
1614
+ if (options.addSuffix && tokenValue.otherWithSuffix) {
1615
+ result = tokenValue.otherWithSuffix.replace("{{count}}", String(count));
1616
+ } else {
1617
+ result = tokenValue.other.replace("{{count}}", String(count));
1618
+ }
1619
+ }
1620
+
1621
+ if (options.addSuffix) {
1622
+ if (options.comparison && options.comparison > 0) {
1623
+ return result + "後";
1624
+ } else {
1625
+ return result + "前";
1626
+ }
1627
+ }
1628
+
1629
+ return result;
1630
+ };
1631
+
1632
+ const dateFormats$1 = {
1633
+ full: "y年M月d日EEEE",
1634
+ long: "y年M月d日",
1635
+ medium: "y/MM/dd",
1636
+ short: "y/MM/dd",
1637
+ };
1638
+
1639
+ const timeFormats$1 = {
1640
+ full: "H時mm分ss秒 zzzz",
1641
+ long: "H:mm:ss z",
1642
+ medium: "H:mm:ss",
1643
+ short: "H:mm",
1644
+ };
1645
+
1646
+ const dateTimeFormats$1 = {
1647
+ full: "{{date}} {{time}}",
1648
+ long: "{{date}} {{time}}",
1649
+ medium: "{{date}} {{time}}",
1650
+ short: "{{date}} {{time}}",
1651
+ };
1652
+
1653
+ const formatLong$1 = {
1654
+ date: buildFormatLongFn({
1655
+ formats: dateFormats$1,
1656
+ defaultWidth: "full",
1657
+ }),
1658
+
1659
+ time: buildFormatLongFn({
1660
+ formats: timeFormats$1,
1661
+ defaultWidth: "full",
1662
+ }),
1663
+
1664
+ dateTime: buildFormatLongFn({
1665
+ formats: dateTimeFormats$1,
1666
+ defaultWidth: "full",
1667
+ }),
1668
+ };
1669
+
1670
+ const formatRelativeLocale$1 = {
1671
+ lastWeek: "先週のeeeeのp",
1672
+ yesterday: "昨日のp",
1673
+ today: "今日のp",
1674
+ tomorrow: "明日のp",
1675
+ nextWeek: "翌週のeeeeのp",
1676
+ other: "P",
1677
+ };
1678
+
1679
+ const formatRelative$1 = (token, _date, _baseDate, _options) => {
1680
+ return formatRelativeLocale$1[token];
1681
+ };
1682
+
1683
+ const eraValues$1 = {
1684
+ narrow: ["BC", "AC"],
1685
+ abbreviated: ["紀元前", "西暦"],
1686
+ wide: ["紀元前", "西暦"],
1687
+ };
1688
+
1689
+ const quarterValues$1 = {
1690
+ narrow: ["1", "2", "3", "4"],
1691
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
1692
+ wide: ["第1四半期", "第2四半期", "第3四半期", "第4四半期"],
1693
+ };
1694
+
1695
+ const monthValues$1 = {
1696
+ narrow: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
1697
+
1698
+ abbreviated: [
1699
+ "1月",
1700
+ "2月",
1701
+ "3月",
1702
+ "4月",
1703
+ "5月",
1704
+ "6月",
1705
+ "7月",
1706
+ "8月",
1707
+ "9月",
1708
+ "10月",
1709
+ "11月",
1710
+ "12月",
1711
+ ],
1712
+
1713
+ wide: [
1714
+ "1月",
1715
+ "2月",
1716
+ "3月",
1717
+ "4月",
1718
+ "5月",
1719
+ "6月",
1720
+ "7月",
1721
+ "8月",
1722
+ "9月",
1723
+ "10月",
1724
+ "11月",
1725
+ "12月",
1726
+ ],
1727
+ };
1728
+
1729
+ const dayValues$1 = {
1730
+ narrow: ["日", "月", "火", "水", "木", "金", "土"],
1731
+ short: ["日", "月", "火", "水", "木", "金", "土"],
1732
+ abbreviated: ["日", "月", "火", "水", "木", "金", "土"],
1733
+ wide: ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"],
1734
+ };
1735
+
1736
+ const dayPeriodValues$1 = {
1737
+ narrow: {
1738
+ am: "午前",
1739
+ pm: "午後",
1740
+ midnight: "深夜",
1741
+ noon: "正午",
1742
+ morning: "朝",
1743
+ afternoon: "午後",
1744
+ evening: "夜",
1745
+ night: "深夜",
1746
+ },
1747
+ abbreviated: {
1748
+ am: "午前",
1749
+ pm: "午後",
1750
+ midnight: "深夜",
1751
+ noon: "正午",
1752
+ morning: "朝",
1753
+ afternoon: "午後",
1754
+ evening: "夜",
1755
+ night: "深夜",
1756
+ },
1757
+ wide: {
1758
+ am: "午前",
1759
+ pm: "午後",
1760
+ midnight: "深夜",
1761
+ noon: "正午",
1762
+ morning: "朝",
1763
+ afternoon: "午後",
1764
+ evening: "夜",
1765
+ night: "深夜",
1766
+ },
1767
+ };
1768
+ const formattingDayPeriodValues$1 = {
1769
+ narrow: {
1770
+ am: "午前",
1771
+ pm: "午後",
1772
+ midnight: "深夜",
1773
+ noon: "正午",
1774
+ morning: "朝",
1775
+ afternoon: "午後",
1776
+ evening: "夜",
1777
+ night: "深夜",
1778
+ },
1779
+ abbreviated: {
1780
+ am: "午前",
1781
+ pm: "午後",
1782
+ midnight: "深夜",
1783
+ noon: "正午",
1784
+ morning: "朝",
1785
+ afternoon: "午後",
1786
+ evening: "夜",
1787
+ night: "深夜",
1788
+ },
1789
+ wide: {
1790
+ am: "午前",
1791
+ pm: "午後",
1792
+ midnight: "深夜",
1793
+ noon: "正午",
1794
+ morning: "朝",
1795
+ afternoon: "午後",
1796
+ evening: "夜",
1797
+ night: "深夜",
1798
+ },
1799
+ };
1800
+
1801
+ const ordinalNumber$1 = (dirtyNumber, options) => {
1802
+ const number = Number(dirtyNumber);
1803
+ const unit = String(options?.unit);
1804
+
1805
+ switch (unit) {
1806
+ case "year":
1807
+ return `${number}年`;
1808
+ case "quarter":
1809
+ return `第${number}四半期`;
1810
+ case "month":
1811
+ return `${number}月`;
1812
+ case "week":
1813
+ return `第${number}週`;
1814
+ case "date":
1815
+ return `${number}日`;
1816
+ case "hour":
1817
+ return `${number}時`;
1818
+ case "minute":
1819
+ return `${number}分`;
1820
+ case "second":
1821
+ return `${number}秒`;
1822
+ default:
1823
+ return `${number}`;
1824
+ }
1825
+ };
1826
+
1827
+ const localize$1 = {
1828
+ ordinalNumber: ordinalNumber$1,
1829
+
1830
+ era: buildLocalizeFn({
1831
+ values: eraValues$1,
1832
+ defaultWidth: "wide",
1833
+ }),
1834
+
1835
+ quarter: buildLocalizeFn({
1836
+ values: quarterValues$1,
1837
+ defaultWidth: "wide",
1838
+ argumentCallback: (quarter) => Number(quarter) - 1,
1839
+ }),
1840
+
1841
+ month: buildLocalizeFn({
1842
+ values: monthValues$1,
1843
+ defaultWidth: "wide",
1844
+ }),
1845
+
1846
+ day: buildLocalizeFn({
1847
+ values: dayValues$1,
1848
+ defaultWidth: "wide",
1849
+ }),
1850
+
1851
+ dayPeriod: buildLocalizeFn({
1852
+ values: dayPeriodValues$1,
1853
+ defaultWidth: "wide",
1854
+ formattingValues: formattingDayPeriodValues$1,
1855
+ defaultFormattingWidth: "wide",
1856
+ }),
1857
+ };
1858
+
1859
+ const matchOrdinalNumberPattern$1 = /^第?\d+(年|四半期|月|週|日|時|分|秒)?/i;
1860
+ const parseOrdinalNumberPattern$1 = /\d+/i;
1861
+
1862
+ const matchEraPatterns$1 = {
1863
+ narrow: /^(B\.?C\.?|A\.?D\.?)/i,
1864
+ abbreviated: /^(紀元[前後]|西暦)/i,
1865
+ wide: /^(紀元[前後]|西暦)/i,
1866
+ };
1867
+ const parseEraPatterns$1 = {
1868
+ narrow: [/^B/i, /^A/i],
1869
+ any: [/^(紀元前)/i, /^(西暦|紀元後)/i],
1870
+ };
1871
+
1872
+ const matchQuarterPatterns$1 = {
1873
+ narrow: /^[1234]/i,
1874
+ abbreviated: /^Q[1234]/i,
1875
+ wide: /^第[1234一二三四1234]四半期/i,
1876
+ };
1877
+ const parseQuarterPatterns$1 = {
1878
+ any: [/(1|一|1)/i, /(2|二|2)/i, /(3|三|3)/i, /(4|四|4)/i],
1879
+ };
1880
+
1881
+ const matchMonthPatterns$1 = {
1882
+ narrow: /^([123456789]|1[012])/,
1883
+ abbreviated: /^([123456789]|1[012])月/i,
1884
+ wide: /^([123456789]|1[012])月/i,
1885
+ };
1886
+ const parseMonthPatterns$1 = {
1887
+ any: [
1888
+ /^1\D/,
1889
+ /^2/,
1890
+ /^3/,
1891
+ /^4/,
1892
+ /^5/,
1893
+ /^6/,
1894
+ /^7/,
1895
+ /^8/,
1896
+ /^9/,
1897
+ /^10/,
1898
+ /^11/,
1899
+ /^12/,
1900
+ ],
1901
+ };
1902
+
1903
+ const matchDayPatterns$1 = {
1904
+ narrow: /^[日月火水木金土]/,
1905
+ short: /^[日月火水木金土]/,
1906
+ abbreviated: /^[日月火水木金土]/,
1907
+ wide: /^[日月火水木金土]曜日/,
1908
+ };
1909
+ const parseDayPatterns$1 = {
1910
+ any: [/^日/, /^月/, /^火/, /^水/, /^木/, /^金/, /^土/],
1911
+ };
1912
+
1913
+ const matchDayPeriodPatterns$1 = {
1914
+ any: /^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i,
1915
+ };
1916
+ const parseDayPeriodPatterns$1 = {
1917
+ any: {
1918
+ am: /^(A|午前)/i,
1919
+ pm: /^(P|午後)/i,
1920
+ midnight: /^深夜|真夜中/i,
1921
+ noon: /^正午/i,
1922
+ morning: /^朝/i,
1923
+ afternoon: /^午後/i,
1924
+ evening: /^夜/i,
1925
+ night: /^深夜/i,
1926
+ },
1927
+ };
1928
+
1929
+ const match$1 = {
1930
+ ordinalNumber: buildMatchPatternFn({
1931
+ matchPattern: matchOrdinalNumberPattern$1,
1932
+ parsePattern: parseOrdinalNumberPattern$1,
1933
+ valueCallback: function (value) {
1934
+ return parseInt(value, 10);
1935
+ },
1936
+ }),
1937
+
1938
+ era: buildMatchFn({
1939
+ matchPatterns: matchEraPatterns$1,
1940
+ defaultMatchWidth: "wide",
1941
+ parsePatterns: parseEraPatterns$1,
1942
+ defaultParseWidth: "any",
1943
+ }),
1944
+
1945
+ quarter: buildMatchFn({
1946
+ matchPatterns: matchQuarterPatterns$1,
1947
+ defaultMatchWidth: "wide",
1948
+ parsePatterns: parseQuarterPatterns$1,
1949
+ defaultParseWidth: "any",
1950
+ valueCallback: (index) => index + 1,
1951
+ }),
1952
+
1953
+ month: buildMatchFn({
1954
+ matchPatterns: matchMonthPatterns$1,
1955
+ defaultMatchWidth: "wide",
1956
+ parsePatterns: parseMonthPatterns$1,
1957
+ defaultParseWidth: "any",
1958
+ }),
1959
+
1960
+ day: buildMatchFn({
1961
+ matchPatterns: matchDayPatterns$1,
1962
+ defaultMatchWidth: "wide",
1963
+ parsePatterns: parseDayPatterns$1,
1964
+ defaultParseWidth: "any",
1965
+ }),
1966
+
1967
+ dayPeriod: buildMatchFn({
1968
+ matchPatterns: matchDayPeriodPatterns$1,
1969
+ defaultMatchWidth: "any",
1970
+ parsePatterns: parseDayPeriodPatterns$1,
1971
+ defaultParseWidth: "any",
1972
+ }),
1973
+ };
1974
+
1975
+ /**
1976
+ * @category Locales
1977
+ * @summary Japanese locale.
1978
+ * @language Japanese
1979
+ * @iso-639-2 jpn
1980
+ * @author Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu)
1981
+ * @author Yamagishi Kazutoshi [@ykzts](https://github.com/ykzts)
1982
+ * @author Luca Ban [@mesqueeb](https://github.com/mesqueeb)
1983
+ * @author Terrence Lam [@skyuplam](https://github.com/skyuplam)
1984
+ * @author Taiki IKeda [@so99ynoodles](https://github.com/so99ynoodles)
1985
+ */
1986
+ const ja = {
1987
+ code: "ja",
1988
+ formatDistance: formatDistance$1,
1989
+ formatLong: formatLong$1,
1990
+ formatRelative: formatRelative$1,
1991
+ localize: localize$1,
1992
+ match: match$1,
1993
+ options: {
1994
+ weekStartsOn: 0 /* Sunday */,
1995
+ firstWeekContainsDate: 1,
1996
+ },
1997
+ };
1998
+
1999
+ const formatDistanceLocale = {
2000
+ lessThanXSeconds: {
2001
+ one: "不到 1 秒",
2002
+ other: "不到 {{count}} 秒",
2003
+ },
2004
+
2005
+ xSeconds: {
2006
+ one: "1 秒",
2007
+ other: "{{count}} 秒",
2008
+ },
2009
+
2010
+ halfAMinute: "半分钟",
2011
+
2012
+ lessThanXMinutes: {
2013
+ one: "不到 1 分钟",
2014
+ other: "不到 {{count}} 分钟",
2015
+ },
2016
+
2017
+ xMinutes: {
2018
+ one: "1 分钟",
2019
+ other: "{{count}} 分钟",
2020
+ },
2021
+
2022
+ xHours: {
2023
+ one: "1 小时",
2024
+ other: "{{count}} 小时",
2025
+ },
2026
+
2027
+ aboutXHours: {
2028
+ one: "大约 1 小时",
2029
+ other: "大约 {{count}} 小时",
2030
+ },
2031
+
2032
+ xDays: {
2033
+ one: "1 天",
2034
+ other: "{{count}} 天",
2035
+ },
2036
+
2037
+ aboutXWeeks: {
2038
+ one: "大约 1 个星期",
2039
+ other: "大约 {{count}} 个星期",
2040
+ },
2041
+
2042
+ xWeeks: {
2043
+ one: "1 个星期",
2044
+ other: "{{count}} 个星期",
2045
+ },
2046
+
2047
+ aboutXMonths: {
2048
+ one: "大约 1 个月",
2049
+ other: "大约 {{count}} 个月",
2050
+ },
2051
+
2052
+ xMonths: {
2053
+ one: "1 个月",
2054
+ other: "{{count}} 个月",
2055
+ },
2056
+
2057
+ aboutXYears: {
2058
+ one: "大约 1 年",
2059
+ other: "大约 {{count}} 年",
2060
+ },
2061
+
2062
+ xYears: {
2063
+ one: "1 年",
2064
+ other: "{{count}} 年",
2065
+ },
2066
+
2067
+ overXYears: {
2068
+ one: "超过 1 年",
2069
+ other: "超过 {{count}} 年",
2070
+ },
2071
+
2072
+ almostXYears: {
2073
+ one: "将近 1 年",
2074
+ other: "将近 {{count}} 年",
2075
+ },
2076
+ };
2077
+
2078
+ const formatDistance = (token, count, options) => {
2079
+ let result;
2080
+
2081
+ const tokenValue = formatDistanceLocale[token];
2082
+ if (typeof tokenValue === "string") {
2083
+ result = tokenValue;
2084
+ } else if (count === 1) {
2085
+ result = tokenValue.one;
2086
+ } else {
2087
+ result = tokenValue.other.replace("{{count}}", String(count));
2088
+ }
2089
+
2090
+ if (options?.addSuffix) {
2091
+ if (options.comparison && options.comparison > 0) {
2092
+ return result + "内";
2093
+ } else {
2094
+ return result + "前";
2095
+ }
2096
+ }
2097
+
2098
+ return result;
2099
+ };
2100
+
2101
+ const dateFormats = {
2102
+ full: "y'年'M'月'd'日' EEEE",
2103
+ long: "y'年'M'月'd'日'",
2104
+ medium: "yyyy-MM-dd",
2105
+ short: "yy-MM-dd",
2106
+ };
2107
+
2108
+ const timeFormats = {
2109
+ full: "zzzz a h:mm:ss",
2110
+ long: "z a h:mm:ss",
2111
+ medium: "a h:mm:ss",
2112
+ short: "a h:mm",
2113
+ };
2114
+
2115
+ const dateTimeFormats = {
2116
+ full: "{{date}} {{time}}",
2117
+ long: "{{date}} {{time}}",
2118
+ medium: "{{date}} {{time}}",
2119
+ short: "{{date}} {{time}}",
2120
+ };
2121
+
2122
+ const formatLong = {
2123
+ date: buildFormatLongFn({
2124
+ formats: dateFormats,
2125
+ defaultWidth: "full",
2126
+ }),
2127
+
2128
+ time: buildFormatLongFn({
2129
+ formats: timeFormats,
2130
+ defaultWidth: "full",
2131
+ }),
2132
+
2133
+ dateTime: buildFormatLongFn({
2134
+ formats: dateTimeFormats,
2135
+ defaultWidth: "full",
2136
+ }),
2137
+ };
2138
+
2139
+ function checkWeek(date, baseDate, options) {
2140
+ const baseFormat = "eeee p";
2141
+
2142
+ if (isSameWeek(date, baseDate, options)) {
2143
+ return baseFormat; // in same week
2144
+ } else if (date.getTime() > baseDate.getTime()) {
2145
+ return "'下个'" + baseFormat; // in next week
2146
+ }
2147
+ return "'上个'" + baseFormat; // in last week
2148
+ }
2149
+
2150
+ const formatRelativeLocale = {
2151
+ lastWeek: checkWeek, // days before yesterday, maybe in this week or last week
2152
+ yesterday: "'昨天' p",
2153
+ today: "'今天' p",
2154
+ tomorrow: "'明天' p",
2155
+ nextWeek: checkWeek, // days after tomorrow, maybe in this week or next week
2156
+ other: "PP p",
2157
+ };
2158
+
2159
+ const formatRelative = (token, date, baseDate, options) => {
2160
+ const format = formatRelativeLocale[token];
2161
+
2162
+ if (typeof format === "function") {
2163
+ return format(date, baseDate, options);
2164
+ }
2165
+
2166
+ return format;
2167
+ };
2168
+
2169
+ const eraValues = {
2170
+ narrow: ["前", "公元"],
2171
+ abbreviated: ["前", "公元"],
2172
+ wide: ["公元前", "公元"],
2173
+ };
2174
+
2175
+ const quarterValues = {
2176
+ narrow: ["1", "2", "3", "4"],
2177
+ abbreviated: ["第一季", "第二季", "第三季", "第四季"],
2178
+ wide: ["第一季度", "第二季度", "第三季度", "第四季度"],
2179
+ };
2180
+
2181
+ const monthValues = {
2182
+ narrow: [
2183
+ "一",
2184
+ "二",
2185
+ "三",
2186
+ "四",
2187
+ "五",
2188
+ "六",
2189
+ "七",
2190
+ "八",
2191
+ "九",
2192
+ "十",
2193
+ "十一",
2194
+ "十二",
2195
+ ],
2196
+
2197
+ abbreviated: [
2198
+ "1月",
2199
+ "2月",
2200
+ "3月",
2201
+ "4月",
2202
+ "5月",
2203
+ "6月",
2204
+ "7月",
2205
+ "8月",
2206
+ "9月",
2207
+ "10月",
2208
+ "11月",
2209
+ "12月",
2210
+ ],
2211
+
2212
+ wide: [
2213
+ "一月",
2214
+ "二月",
2215
+ "三月",
2216
+ "四月",
2217
+ "五月",
2218
+ "六月",
2219
+ "七月",
2220
+ "八月",
2221
+ "九月",
2222
+ "十月",
2223
+ "十一月",
2224
+ "十二月",
2225
+ ],
2226
+ };
2227
+
2228
+ const dayValues = {
2229
+ narrow: ["日", "一", "二", "三", "四", "五", "六"],
2230
+ short: ["日", "一", "二", "三", "四", "五", "六"],
2231
+ abbreviated: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
2232
+
2233
+ wide: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
2234
+ };
2235
+
2236
+ const dayPeriodValues = {
2237
+ narrow: {
2238
+ am: "上",
2239
+ pm: "下",
2240
+ midnight: "凌晨",
2241
+ noon: "午",
2242
+ morning: "早",
2243
+ afternoon: "下午",
2244
+ evening: "晚",
2245
+ night: "夜",
2246
+ },
2247
+ abbreviated: {
2248
+ am: "上午",
2249
+ pm: "下午",
2250
+ midnight: "凌晨",
2251
+ noon: "中午",
2252
+ morning: "早晨",
2253
+ afternoon: "中午",
2254
+ evening: "晚上",
2255
+ night: "夜间",
2256
+ },
2257
+ wide: {
2258
+ am: "上午",
2259
+ pm: "下午",
2260
+ midnight: "凌晨",
2261
+ noon: "中午",
2262
+ morning: "早晨",
2263
+ afternoon: "中午",
2264
+ evening: "晚上",
2265
+ night: "夜间",
2266
+ },
2267
+ };
2268
+
2269
+ const formattingDayPeriodValues = {
2270
+ narrow: {
2271
+ am: "上",
2272
+ pm: "下",
2273
+ midnight: "凌晨",
2274
+ noon: "午",
2275
+ morning: "早",
2276
+ afternoon: "下午",
2277
+ evening: "晚",
2278
+ night: "夜",
2279
+ },
2280
+ abbreviated: {
2281
+ am: "上午",
2282
+ pm: "下午",
2283
+ midnight: "凌晨",
2284
+ noon: "中午",
2285
+ morning: "早晨",
2286
+ afternoon: "中午",
2287
+ evening: "晚上",
2288
+ night: "夜间",
2289
+ },
2290
+ wide: {
2291
+ am: "上午",
2292
+ pm: "下午",
2293
+ midnight: "凌晨",
2294
+ noon: "中午",
2295
+ morning: "早晨",
2296
+ afternoon: "中午",
2297
+ evening: "晚上",
2298
+ night: "夜间",
2299
+ },
2300
+ };
2301
+
2302
+ const ordinalNumber = (dirtyNumber, options) => {
2303
+ const number = Number(dirtyNumber);
2304
+
2305
+ switch (options?.unit) {
2306
+ case "date":
2307
+ return number.toString() + "日";
2308
+ case "hour":
2309
+ return number.toString() + "时";
2310
+ case "minute":
2311
+ return number.toString() + "分";
2312
+ case "second":
2313
+ return number.toString() + "秒";
2314
+ default:
2315
+ return "第 " + number.toString();
2316
+ }
2317
+ };
2318
+
2319
+ const localize = {
2320
+ ordinalNumber,
2321
+
2322
+ era: buildLocalizeFn({
2323
+ values: eraValues,
2324
+ defaultWidth: "wide",
2325
+ }),
2326
+
2327
+ quarter: buildLocalizeFn({
2328
+ values: quarterValues,
2329
+ defaultWidth: "wide",
2330
+ argumentCallback: (quarter) => quarter - 1,
2331
+ }),
2332
+
2333
+ month: buildLocalizeFn({
2334
+ values: monthValues,
2335
+ defaultWidth: "wide",
2336
+ }),
2337
+
2338
+ day: buildLocalizeFn({
2339
+ values: dayValues,
2340
+ defaultWidth: "wide",
2341
+ }),
2342
+
2343
+ dayPeriod: buildLocalizeFn({
2344
+ values: dayPeriodValues,
2345
+ defaultWidth: "wide",
2346
+ formattingValues: formattingDayPeriodValues,
2347
+ defaultFormattingWidth: "wide",
2348
+ }),
2349
+ };
2350
+
2351
+ const matchOrdinalNumberPattern = /^(第\s*)?\d+(日|时|分|秒)?/i;
2352
+ const parseOrdinalNumberPattern = /\d+/i;
2353
+
2354
+ const matchEraPatterns = {
2355
+ narrow: /^(前)/i,
2356
+ abbreviated: /^(前)/i,
2357
+ wide: /^(公元前|公元)/i,
2358
+ };
2359
+ const parseEraPatterns = {
2360
+ any: [/^(前)/i, /^(公元)/i],
2361
+ };
2362
+
2363
+ const matchQuarterPatterns = {
2364
+ narrow: /^[1234]/i,
2365
+ abbreviated: /^第[一二三四]刻/i,
2366
+ wide: /^第[一二三四]刻钟/i,
2367
+ };
2368
+ const parseQuarterPatterns = {
2369
+ any: [/(1|一)/i, /(2|二)/i, /(3|三)/i, /(4|四)/i],
2370
+ };
2371
+
2372
+ const matchMonthPatterns = {
2373
+ narrow: /^(一|二|三|四|五|六|七|八|九|十[二一])/i,
2374
+ abbreviated: /^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,
2375
+ wide: /^(一|二|三|四|五|六|七|八|九|十[二一])月/i,
2376
+ };
2377
+ const parseMonthPatterns = {
2378
+ narrow: [
2379
+ /^一/i,
2380
+ /^二/i,
2381
+ /^三/i,
2382
+ /^四/i,
2383
+ /^五/i,
2384
+ /^六/i,
2385
+ /^七/i,
2386
+ /^八/i,
2387
+ /^九/i,
2388
+ /^十(?!(一|二))/i,
2389
+ /^十一/i,
2390
+ /^十二/i,
2391
+ ],
2392
+
2393
+ any: [
2394
+ /^一|1/i,
2395
+ /^二|2/i,
2396
+ /^三|3/i,
2397
+ /^四|4/i,
2398
+ /^五|5/i,
2399
+ /^六|6/i,
2400
+ /^七|7/i,
2401
+ /^八|8/i,
2402
+ /^九|9/i,
2403
+ /^十(?!(一|二))|10/i,
2404
+ /^十一|11/i,
2405
+ /^十二|12/i,
2406
+ ],
2407
+ };
2408
+
2409
+ const matchDayPatterns = {
2410
+ narrow: /^[一二三四五六日]/i,
2411
+ short: /^[一二三四五六日]/i,
2412
+ abbreviated: /^周[一二三四五六日]/i,
2413
+ wide: /^星期[一二三四五六日]/i,
2414
+ };
2415
+ const parseDayPatterns = {
2416
+ any: [/日/i, /一/i, /二/i, /三/i, /四/i, /五/i, /六/i],
2417
+ };
2418
+
2419
+ const matchDayPeriodPatterns = {
2420
+ any: /^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i,
2421
+ };
2422
+ const parseDayPeriodPatterns = {
2423
+ any: {
2424
+ am: /^上午?/i,
2425
+ pm: /^下午?/i,
2426
+ midnight: /^午夜/i,
2427
+ noon: /^[中正]午/i,
2428
+ morning: /^早上/i,
2429
+ afternoon: /^下午/i,
2430
+ evening: /^晚上?/i,
2431
+ night: /^凌晨/i,
2432
+ },
2433
+ };
2434
+
2435
+ const match = {
2436
+ ordinalNumber: buildMatchPatternFn({
2437
+ matchPattern: matchOrdinalNumberPattern,
2438
+ parsePattern: parseOrdinalNumberPattern,
2439
+ valueCallback: (value) => parseInt(value, 10),
2440
+ }),
2441
+
2442
+ era: buildMatchFn({
2443
+ matchPatterns: matchEraPatterns,
2444
+ defaultMatchWidth: "wide",
2445
+ parsePatterns: parseEraPatterns,
2446
+ defaultParseWidth: "any",
2447
+ }),
2448
+
2449
+ quarter: buildMatchFn({
2450
+ matchPatterns: matchQuarterPatterns,
2451
+ defaultMatchWidth: "wide",
2452
+ parsePatterns: parseQuarterPatterns,
2453
+ defaultParseWidth: "any",
2454
+ valueCallback: (index) => index + 1,
2455
+ }),
2456
+
2457
+ month: buildMatchFn({
2458
+ matchPatterns: matchMonthPatterns,
2459
+ defaultMatchWidth: "wide",
2460
+ parsePatterns: parseMonthPatterns,
2461
+ defaultParseWidth: "any",
2462
+ }),
2463
+
2464
+ day: buildMatchFn({
2465
+ matchPatterns: matchDayPatterns,
2466
+ defaultMatchWidth: "wide",
2467
+ parsePatterns: parseDayPatterns,
2468
+ defaultParseWidth: "any",
2469
+ }),
2470
+
2471
+ dayPeriod: buildMatchFn({
2472
+ matchPatterns: matchDayPeriodPatterns,
2473
+ defaultMatchWidth: "any",
2474
+ parsePatterns: parseDayPeriodPatterns,
2475
+ defaultParseWidth: "any",
2476
+ }),
2477
+ };
2478
+
2479
+ /**
2480
+ * @category Locales
2481
+ * @summary Chinese Simplified locale.
2482
+ * @language Chinese Simplified
2483
+ * @iso-639-2 zho
2484
+ * @author Changyu Geng [@KingMario](https://github.com/KingMario)
2485
+ * @author Song Shuoyun [@fnlctrl](https://github.com/fnlctrl)
2486
+ * @author sabrinaM [@sabrinamiao](https://github.com/sabrinamiao)
2487
+ * @author Carney Wu [@cubicwork](https://github.com/cubicwork)
2488
+ * @author Terrence Lam [@skyuplam](https://github.com/skyuplam)
2489
+ */
2490
+ const zhCN = {
2491
+ code: "zh-CN",
2492
+ formatDistance: formatDistance,
2493
+ formatLong: formatLong,
2494
+ formatRelative: formatRelative,
2495
+ localize: localize,
2496
+ match: match,
2497
+ options: {
2498
+ weekStartsOn: 1 /* Monday */,
2499
+ firstWeekContainsDate: 4,
2500
+ },
2501
+ };
2502
+
2503
+ const startPageCss = ":host{display:grid;block-size:100%;overflow:auto}.main{animation:fadeIn 300ms forwards;display:grid;block-size:100%;overflow:auto;opacity:0;grid-template-rows:max-content 1fr;gap:var(--mer-spacing--xl)}@keyframes bounce{0%{transform:translateY(0)}100%{transform:translateY(-30px)}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}.section-create-new-kb__actions,.section-secondary__actions{display:grid;grid-auto-flow:column;gap:var(--mer-spacing--md);overflow-x:auto;padding-block-end:var(--mer-spacing--xs)}.card-filled,.card-outlined{display:grid;gap:var(--mer-spacing--xl);align-content:space-between;border:var(--mer-border__width--sm) solid var(--mer-border-color__on-surface);border-radius:var(--mer-border__radius--sm);padding:var(--mer-spacing--lg)}.card-filled{background-color:var(--mer-surface__elevation--01)}.icon-capsule{pointer-events:none;display:inline-flex;block-size:40px;inline-size:40px;justify-content:center;align-items:center;border-radius:50%;border:var(--mer-border__width--sm) dashed var(--mer-border-color__on-elevation--02)}.card__header{display:grid;gap:var(--mer-spacing--sm)}.card__header-description{display:grid;gap:var(--mer-spacing--2xs)}.section-create-new-kb{display:grid;grid-auto-rows:max-content;gap:var(--mer-spacing--lg)}.section-create-new-kb__header{display:grid;gap:var(--mer-spacing--2xs)}.section-create-new-kb__actions{display:grid;gap:var(--mer-spacing--md);overflow-x:auto;grid-auto-flow:column;grid-auto-columns:430px}.section-secondary{display:grid;block-size:100%;position:relative;overflow:auto}.section-secondary__actions{display:grid;gap:var(--mer-spacing--sm)}.section-secondary__actions--two-cards{grid-template-columns:repeat(2, minmax(430px, 1fr))}.section-secondary__actions--multiple-cards{grid-auto-columns:670px}.section-kbs{background-color:var(--mer-surface__elevation--01);border-radius:var(--mer-border__radius--sm);padding:var(--mer-spacing--sm);display:grid;grid-template-rows:auto 1fr;overflow:auto}.section-kbs__header{display:grid;grid-template-columns:max-content 230px;align-items:center;gap:var(--mer-spacing--xl);border-block-end:var(--mer-border__width--sm) solid var(--mer-border-color__on-elevation--03);padding-block-end:var(--mer-spacing--sm)}.section-kbs__header--no-border{border-block-end-color:transparent !important}.section-kbs__title{align-items:center;display:flex;min-block-size:31px}.section-kbs__filter--hidden{opacity:0}.section-kbs__list{display:grid;grid-auto-rows:max-content;grid-template-columns:1fr 1fr;row-gap:var(--mer-spacing--xs);column-gap:var(--mer-spacing--md);overflow:auto;position:relative;padding-block-start:var(--mer-spacing--sm)}.section-kbs__list--empty{grid-template-columns:1fr;grid-auto-rows:1fr;overflow:hidden}.kb__item{background-color:var(--mer-surface__elevation--02);padding:var(--mer-spacing--sm);display:grid;grid-template-columns:284px 1fr;gap:var(--mer-spacing--md)}.kb__details{display:grid;grid-template-columns:max-content 1fr;align-items:center;gap:var(--mer-spacing--sm)}.kb__name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-decoration:underline;cursor:pointer}.kb__name:hover{color:var(--mer-text__bright)}.kb__modified{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.hiChar{color:var(--mer-color__primary--200);filter:brightness(1.3)}.loader{border:var(--mer-border__width--sm) solid var(--mer-border-color__on-surface)}.heading-2,.heading-3{margin:0;font-weight:600 !important;color:#ffffff !important}.card-filled .heading-3{color:var(--mer-text__on-surface) !important}.text-body-regular-m,.card__footer{font-weight:var(--mer-font__weight--light) !important;--control__font-weight--regular:var(--mer-font__weight--light)}";
8
2504
 
9
2505
  var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10
2506
  if (kind === "a" && !f)
@@ -22,7 +2518,34 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
22
2518
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
23
2519
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
24
2520
  };
25
- var _GxIdeStartPage_recentKbsFilter, _GxIdeStartPage_kbsFilterValue, _GxIdeStartPage_kbRefs, _GxIdeStartPage_evaluateRenderKbs, _GxIdeStartPage_filterKbs, _GxIdeStartPage_getNewsCallbackRecentNews, _GxIdeStartPage_openKbHandler, _GxIdeStartPage_renderKb, _GxIdeStartPage_renderKbs, _GxIdeStartPage_searchKbsInputHandler, _GxIdeStartPage_searchNewsInputHandler;
2521
+ var _GxIdeStartPage_instances, _GxIdeStartPage_componentLocale, _GxIdeStartPage_userLanguage, _GxIdeStartPage_createKBClickHandler, _GxIdeStartPage_openKbClickHandler, _GxIdeStartPage_filterKbs, _GxIdeStartPage_renderKbsSection, _GxIdeStartPage_renderKbs, _GxIdeStartPage_evaluateContentToRender, _GxIdeStartPage_renderSecondarySection;
2522
+ // const locale = enUS; // use `zhCN` for Chinese, `ja` for Japanese, `enUS` for English
2523
+ const LANGS_DATE_FNS_MAP = {
2524
+ "en": enUS,
2525
+ "ja": ja,
2526
+ "zh-CN": zhCN,
2527
+ "zh-TW": zhCN,
2528
+ "zh-HK": zhCN
2529
+ };
2530
+ const DETAIL_ICON = getIconPath({
2531
+ category: "system",
2532
+ name: "detail",
2533
+ colorType: "primary"
2534
+ });
2535
+ const FILTER_ICON = getIconPath({
2536
+ category: "window-tools",
2537
+ name: "filter",
2538
+ colorType: "on-elevation"
2539
+ });
2540
+ const KB_DEFAULT_ICON = getIconPath({
2541
+ category: "objects",
2542
+ name: "knowledge-base"
2543
+ });
2544
+ const SEARCH_ICON = getIconPath({
2545
+ category: "system",
2546
+ name: "search",
2547
+ colorType: "on-elevation"
2548
+ });
26
2549
  const CSS_BUNDLES = [
27
2550
  "resets/box-sizing",
28
2551
  "utils/typography",
@@ -30,130 +2553,147 @@ const CSS_BUNDLES = [
30
2553
  "components/edit",
31
2554
  "components/icon",
32
2555
  "components/button",
33
- "chameleon/scrollbar"
2556
+ "chameleon/scrollbar",
2557
+ "utils/typography"
34
2558
  ];
35
- const KB_ICON = getIconPath({
36
- category: "objects",
37
- name: "knowledge-base"
38
- });
39
- const FOLDER_ICON = getIconPath({
40
- category: "system",
41
- name: "folder",
42
- colorType: "on-elevation"
43
- });
44
2559
  const GxIdeStartPage = class {
45
2560
  constructor(hostRef) {
46
2561
  registerInstance(this, hostRef);
47
- _GxIdeStartPage_recentKbsFilter.set(this, void 0);
48
- _GxIdeStartPage_kbsFilterValue.set(this, "");
49
- _GxIdeStartPage_kbRefs.set(this, {}); // Object to store kbs refs
50
- _GxIdeStartPage_evaluateRenderKbs.set(this, () => {
51
- var _a;
52
- if (((_a = this.kbs) === null || _a === void 0 ? void 0 : _a.length) > 0) {
53
- return __classPrivateFieldGet(this, _GxIdeStartPage_renderKbs, "f").call(this);
54
- }
55
- else {
56
- return (h("gx-ide-empty-state", { class: "kbs-empty-state", stateIconSrc: FOLDER_ICON, stateTitle: this._componentLocale.emptyState.title, stateDescription: this._componentLocale.emptyState.description }));
57
- }
2562
+ _GxIdeStartPage_instances.add(this);
2563
+ /**
2564
+ * The component hard-coded strings translations.
2565
+ */
2566
+ // eslint-disable-next-line @stencil-community/own-props-must-be-private
2567
+ _GxIdeStartPage_componentLocale.set(this, void 0);
2568
+ _GxIdeStartPage_userLanguage.set(this, void 0);
2569
+ _GxIdeStartPage_createKBClickHandler.set(this, (fromServer) => (event) => {
2570
+ event.stopPropagation();
2571
+ this.createKBCallback(fromServer);
58
2572
  });
59
- _GxIdeStartPage_filterKbs.set(this, () => {
60
- this.filteredKbs = this.kbs.filter(kb => { var _a; return (_a = kb.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(__classPrivateFieldGet(this, _GxIdeStartPage_kbsFilterValue, "f")); });
2573
+ _GxIdeStartPage_openKbClickHandler.set(this, (kbId) => (event) => {
2574
+ event.stopPropagation();
2575
+ this.openKbCallback(kbId);
61
2576
  });
62
- _GxIdeStartPage_getNewsCallbackRecentNews.set(this, async () => {
63
- return new Promise(async (resolve) => {
64
- this.news = await this.getNewsCallback();
65
- resolve(this.news);
66
- });
67
- });
68
- _GxIdeStartPage_openKbHandler.set(this, async (e) => {
69
- const kbId = e.currentTarget.id;
70
- await this.openKbCallback(kbId);
2577
+ _GxIdeStartPage_filterKbs.set(this, (event) => {
2578
+ this.kbFilterValue = event.detail;
71
2579
  });
72
- _GxIdeStartPage_renderKb.set(this, (kb) => {
73
- var _a, _b;
74
- const formattedDate = formatDate(kb.lastOpenedDate, "pretty");
75
- const dateCaption = formattedDate
76
- ? `${this._componentLocale.recentKbs.lastOpened} ${formattedDate}`
77
- : null;
78
- return (h("article", { class: "display-contents" }, h("button", { class: {
79
- "card-small": true,
80
- "card-small--actionable": true,
81
- "card-kb": true,
82
- "exact-match-bright": ((_a = kb.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) ===
83
- ((_b = __classPrivateFieldGet(this, _GxIdeStartPage_kbsFilterValue, "f")) === null || _b === void 0 ? void 0 : _b.toLowerCase())
84
- }, id: kb.id, key: kb.id, type: "button", ref: el => (__classPrivateFieldGet(this, _GxIdeStartPage_kbRefs, "f")[kb.id] = el), onClick: __classPrivateFieldGet(this, _GxIdeStartPage_openKbHandler, "f") }, h("div", { class: "card-kb__left-col" }, h("ch-image", { src: KB_ICON, class: "icon-md", containerRef: __classPrivateFieldGet(this, _GxIdeStartPage_kbRefs, "f")[kb.id] }), h("h2", { class: config.headingsClasses.cardSmall }, hiChar(kb.name, __classPrivateFieldGet(this, _GxIdeStartPage_kbsFilterValue, "f")))), dateCaption && h("div", { class: "card-kb__right-col" }, dateCaption))));
2580
+ _GxIdeStartPage_renderKbsSection.set(this, () => {
2581
+ const hideKbsFilter = this.kbs.length < this.kbsFilterThreshold;
2582
+ const kbsListEmpty = this.filteredKbs.length === 0;
2583
+ let contentToRender;
2584
+ // Evaluate what is the content to display.
2585
+ if (this.filteredKbs.length > 0) {
2586
+ contentToRender = __classPrivateFieldGet(this, _GxIdeStartPage_renderKbs, "f").call(this);
2587
+ }
2588
+ else {
2589
+ // No kb has pass the filter. Display an empty-state.
2590
+ contentToRender = (h("gx-ide-empty-state", { isAnimated: true, stateIconSrc: FILTER_ICON, stateTitle: __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").recentKBs.noMatches }));
2591
+ }
2592
+ return (h("section", { class: "section-kbs" }, h("header", { class: {
2593
+ "section-kbs__header": true
2594
+ } }, h("h2", { class: "heading-3 section-kbs__title" }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").recentKBs.title), h("ch-edit", {
2595
+ // Render always, and display or hide, ro prevent FOUC, and also prevent
2596
+ // the header block-size from growing a little bit when the input renders.
2597
+ value: this.kbFilterValue, class: {
2598
+ "input": true,
2599
+ "section-kbs__filter--hidden": hideKbsFilter
2600
+ }, startImgSrc: SEARCH_ICON, placeholder: __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").recentKBs.filterKbsPlaceholder, onInput: !hideKbsFilter && __classPrivateFieldGet(this, _GxIdeStartPage_filterKbs, "f"), disabled: hideKbsFilter
2601
+ })), h("div", { class: {
2602
+ "section-kbs__list": true,
2603
+ "section-kbs__list--empty": kbsListEmpty,
2604
+ "scrollable": true
2605
+ } }, this.filteredKbs.length > 0 ? __classPrivateFieldGet(this, _GxIdeStartPage_renderKbs, "f").call(this) : contentToRender)));
85
2606
  });
86
2607
  _GxIdeStartPage_renderKbs.set(this, () => {
87
2608
  var _a;
88
- if (this.filteredKbs.length) {
89
- return (h("div", { class: "kbs-container scrollable" }, (_a = this.filteredKbs) === null || _a === void 0 ? void 0 : _a.map(__classPrivateFieldGet(this, _GxIdeStartPage_renderKb, "f"))));
90
- }
91
- return (h("gx-ide-empty-state", { stateIconSrc: KB_ICON, stateTitle: this._componentLocale.recentKbs.noKbsFiltered.title }));
92
- });
93
- _GxIdeStartPage_searchKbsInputHandler.set(this, (event) => {
94
- __classPrivateFieldSet(this, _GxIdeStartPage_kbsFilterValue, event.target.value.toLowerCase(), "f");
95
- __classPrivateFieldGet(this, _GxIdeStartPage_filterKbs, "f").call(this);
2609
+ return (_a = this.filteredKbs) === null || _a === void 0 ? void 0 : _a.map((kb, index) => {
2610
+ // relative time ago
2611
+ var _a;
2612
+ const relativeDate = kb.lastOpenedDate
2613
+ ? formatDistanceToNow(new Date(kb.lastOpenedDate), {
2614
+ addSuffix: true,
2615
+ locale: __classPrivateFieldGet(this, _GxIdeStartPage_userLanguage, "f")
2616
+ })
2617
+ : undefined;
2618
+ // icon
2619
+ const kbIcon = (_a = kb.icon) !== null && _a !== void 0 ? _a : KB_DEFAULT_ICON;
2620
+ return (h("article", { class: "kb__item", key: index }, h("div", { class: "kb__details" }, h("ch-image", { class: "icon-md", src: kbIcon }), h("p", { class: "text-body-regular-m kb__name", onClick: __classPrivateFieldGet(this, _GxIdeStartPage_openKbClickHandler, "f").call(this, kb.id) }, kb.name)), relativeDate && (h("div", { class: "text-body-regular-m kb__modified" }, `${__classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").recentKBs.opened} ${relativeDate}`))));
2621
+ });
96
2622
  });
97
- _GxIdeStartPage_searchNewsInputHandler.set(this, (event) => {
98
- this.newsFilterValue = event.target.value.toLowerCase();
2623
+ _GxIdeStartPage_renderSecondarySection.set(this, () => {
2624
+ if (!this.secondarySection) {
2625
+ return null;
2626
+ }
2627
+ const multipleCards = this.secondarySection.cards.length > 2;
2628
+ return (h("section", {
2629
+ // Recent Knowledge Bases
2630
+ class: "section-secondary"
2631
+ }, h("header", null, h("h2", { class: "heading-3" }, this.secondarySection.title)), h("section", { class: {
2632
+ "section-secondary__actions": true,
2633
+ "section-secondary__actions--two-cards": !multipleCards,
2634
+ "section-secondary__actions--multiple-cards": multipleCards,
2635
+ "scrollable": true
2636
+ } }, this.secondarySection.cards.map((card, index) => {
2637
+ return (h("article", { class: "card card-outlined", key: index }, h("header", { class: "card__header" }, h("span", { class: "icon-capsule" }, h("ch-image", { class: "icon-md icon-circular", src: card.icon.src, "aria-label": card.icon.ariaLabel })), h("div", { class: "card__header-description" }, h("h2", { class: "heading-3" }, card.title), card.description.map(paragraph => (h("p", { class: "text-body-regular-m" }, paragraph))))), h("footer", { class: "card__footer" }, card.action && (h("button", { class: "button-tertiary button-icon-and-text", onClick: card.action.callback && card.action.callback }, h("ch-image", { class: "icon-md", src: DETAIL_ICON }), card.action.caption)))));
2638
+ }))));
99
2639
  });
100
- this.displayKbsFilter = true;
101
- this.displayNewsFilter = false;
102
- this.filteredKbs = [];
103
- this.filteredNews = [];
104
- this.loadingKbs = true;
105
- this.news = undefined;
106
- this.newsFilterValue = undefined;
107
- this.renderedFirstTime = false;
108
- this.getNewsCallback = undefined;
109
- this.kbs = [];
110
- this.kbsFilterThreshold = 6;
111
- this.newsFilterThreshold = 6;
2640
+ this.kbFilterValue = "";
2641
+ this.filteredKbs = undefined;
2642
+ this.loading = true;
2643
+ this.createKBCallback = undefined;
112
2644
  this.openKbCallback = undefined;
113
- this.openNewsCallback = undefined;
114
- }
115
- watchNews(news) {
116
- if ((news === null || news === void 0 ? void 0 : news.length) >= this.newsFilterThreshold) {
117
- this.displayNewsFilter = true;
118
- }
119
- else {
120
- this.displayNewsFilter = false;
121
- }
122
- }
123
- kbsChanged(kbs) {
124
- this.loadingKbs = false;
125
- __classPrivateFieldGet(this, _GxIdeStartPage_filterKbs, "f").call(this);
126
- if ((kbs === null || kbs === void 0 ? void 0 : kbs.length) >= this.kbsFilterThreshold) {
127
- this.displayKbsFilter = true;
128
- }
129
- else {
130
- this.displayKbsFilter = false;
131
- }
2645
+ this.secondarySection = undefined;
2646
+ this.kbs = undefined;
2647
+ this.kbsFilterThreshold = undefined;
132
2648
  }
133
- async componentWillLoad() {
134
- this._componentLocale = await Locale.getComponentStrings(this.el);
2649
+ kbFilterValueChanged(newKbFilterValue) {
2650
+ this.filteredKbs = this.kbs.filter(kb => kb.name.toLowerCase().includes(newKbFilterValue.toLocaleLowerCase()));
135
2651
  }
136
- componentDidLoad() {
137
- var _a;
138
- (_a = __classPrivateFieldGet(this, _GxIdeStartPage_recentKbsFilter, "f")) === null || _a === void 0 ? void 0 : _a.focus();
2652
+ kbsChanged(newKbs) {
2653
+ this.filteredKbs = newKbs;
2654
+ this.kbFilterValue = ""; // clear filter
2655
+ }
2656
+ async componentWillLoad() {
2657
+ __classPrivateFieldSet(this, _GxIdeStartPage_componentLocale, await Locale.getComponentStrings(this.el), "f");
2658
+ // initialize filteredKbs
2659
+ this.kbsChanged(this.kbs);
2660
+ // get user language to display the kb "last opened" value in the appropriate language.
2661
+ const userLanguage = document.documentElement
2662
+ .lang;
2663
+ __classPrivateFieldSet(this, _GxIdeStartPage_userLanguage, LANGS_DATE_FNS_MAP[userLanguage], "f");
139
2664
  }
140
2665
  render() {
141
- var _a, _b, _c;
142
- return (h(Host, { class: "start-page-host" }, h("ch-theme", { model: CSS_BUNDLES }), h("div", { class: "layout layout-main layout--cols-2" }, h("div", { class: "layout__panel panel-recent-kbs" }, h("section", { class: "card-regular recent-kbs" }, h("header", { class: "recent-kbs__header" }, h("h2", { class: {
143
- [config.headingsClasses.cardRegular]: true,
144
- "recent-kbs__title": true
145
- } }, this._componentLocale.recentKbs.title), this.displayKbsFilter && (h("ch-edit", { type: "text", class: "input recent-kbs__name-filter", placeholder: this._componentLocale.recentKbs.placeholder, onInput: __classPrivateFieldGet(this, _GxIdeStartPage_searchKbsInputHandler, "f"), ref: el => (__classPrivateFieldSet(this, _GxIdeStartPage_recentKbsFilter, el, "f")), disabled: !(((_a = this.kbs) === null || _a === void 0 ? void 0 : _a.length) > 0) }))), this.loadingKbs ? (h("gx-ide-loader", { loaderTitle: this._componentLocale.recentKbs.loader.title, description: this._componentLocale.recentKbs.loader.description, show: true })) : (__classPrivateFieldGet(this, _GxIdeStartPage_evaluateRenderKbs, "f").call(this)))), h("div", { class: "layout__panel panel-recent-news" }, h("section", { class: "card-regular recent-news" }, h("header", { class: "recent-news__header" }, h("h2", { class: config.headingsClasses.cardRegular }, this._componentLocale.recentNews.title), this.displayNewsFilter && (h("ch-edit", { type: "text", class: "input recent-news__filter", placeholder: this._componentLocale.recentNews.inputPlaceholder, onInput: ((_b = this.news) === null || _b === void 0 ? void 0 : _b.length) > 0
146
- ? __classPrivateFieldGet(this, _GxIdeStartPage_searchNewsInputHandler, "f")
147
- : null, disabled: !(((_c = this.news) === null || _c === void 0 ? void 0 : _c.length) > 0) }))), h("gx-ide-recent-news", { getNewsCallback: __classPrivateFieldGet(this, _GxIdeStartPage_getNewsCallbackRecentNews, "f"), openNewsCallback: this.openNewsCallback, filterValue: this.newsFilterValue }))))));
2666
+ var _a;
2667
+ this.loading =
2668
+ (!this.kbs || ((_a = this.kbs) === null || _a === void 0 ? void 0 : _a.length) === 0) && !this.secondarySection;
2669
+ return (h(Host, null, h("ch-theme", { model: CSS_BUNDLES }), h("main", { class: {
2670
+ main: true
2671
+ } }, h("section", {
2672
+ // Create a new Knowledge Base
2673
+ class: "section-create-new-kb"
2674
+ }, h("header", {
2675
+ // main header
2676
+ class: "section-create-new__header"
2677
+ }, h("h1", { class: "heading-2" }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").createKB.title), h("p", { class: "text-body-regular-m" }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").createKB.description)), h("section", { class: "section-create-new-kb__actions scrollable" }, h("article", {
2678
+ // create project
2679
+ class: "card card-filled"
2680
+ }, h("header", { class: "card__header" }, h("div", { class: "card__header-description" }, h("h2", { class: "heading-3" }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").createProject.title), h("p", { class: "text-body-regular-m" }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").createProject.description))), h("footer", { class: "card__footer" }, h("button", { class: "button-primary", onClick: __classPrivateFieldGet(this, _GxIdeStartPage_createKBClickHandler, "f").call(this, false) }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").createProject.buttonCaption))), h("article", {
2681
+ // open existing project
2682
+ class: "card-filled"
2683
+ }, h("header", { class: "card__header" }, h("div", { class: "card__header-description" }, h("h2", { class: "heading-3" }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").openExistingProject.title), h("p", { class: "text-body-regular-m" }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").openExistingProject.description))), h("footer", { class: "card__footer" }, h("button", { class: "button-secondary cancel-btn", onClick: __classPrivateFieldGet(this, _GxIdeStartPage_createKBClickHandler, "f").call(this, true) }, __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").openExistingProject.buttonCaption))))), h("section", { class: "section-secondary scrollable" }, this.loading ? (h("gx-ide-loader", { class: "loader", loaderTitle: __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").recentKBs.loaderTitle, description: __classPrivateFieldGet(this, _GxIdeStartPage_componentLocale, "f").recentKBs.loaderDescription, show: true })) : (__classPrivateFieldGet(this, _GxIdeStartPage_instances, "m", _GxIdeStartPage_evaluateContentToRender).call(this))))));
148
2684
  }
149
2685
  static get assetsDirs() { return ["gx-ide-assets/start-page"]; }
150
2686
  get el() { return getElement(this); }
151
2687
  static get watchers() { return {
152
- "news": ["watchNews"],
2688
+ "kbFilterValue": ["kbFilterValueChanged"],
153
2689
  "kbs": ["kbsChanged"]
154
2690
  }; }
155
2691
  };
156
- _GxIdeStartPage_recentKbsFilter = new WeakMap(), _GxIdeStartPage_kbsFilterValue = new WeakMap(), _GxIdeStartPage_kbRefs = new WeakMap(), _GxIdeStartPage_evaluateRenderKbs = new WeakMap(), _GxIdeStartPage_filterKbs = new WeakMap(), _GxIdeStartPage_getNewsCallbackRecentNews = new WeakMap(), _GxIdeStartPage_openKbHandler = new WeakMap(), _GxIdeStartPage_renderKb = new WeakMap(), _GxIdeStartPage_renderKbs = new WeakMap(), _GxIdeStartPage_searchKbsInputHandler = new WeakMap(), _GxIdeStartPage_searchNewsInputHandler = new WeakMap();
2692
+ _GxIdeStartPage_componentLocale = new WeakMap(), _GxIdeStartPage_userLanguage = new WeakMap(), _GxIdeStartPage_createKBClickHandler = new WeakMap(), _GxIdeStartPage_openKbClickHandler = new WeakMap(), _GxIdeStartPage_filterKbs = new WeakMap(), _GxIdeStartPage_renderKbsSection = new WeakMap(), _GxIdeStartPage_renderKbs = new WeakMap(), _GxIdeStartPage_renderSecondarySection = new WeakMap(), _GxIdeStartPage_instances = new WeakSet(), _GxIdeStartPage_evaluateContentToRender = function _GxIdeStartPage_evaluateContentToRender() {
2693
+ return this.kbs && this.kbs.length > 0
2694
+ ? __classPrivateFieldGet(this, _GxIdeStartPage_renderKbsSection, "f").call(this)
2695
+ : __classPrivateFieldGet(this, _GxIdeStartPage_renderSecondarySection, "f").call(this);
2696
+ };
157
2697
  GxIdeStartPage.style = startPageCss;
158
2698
 
159
2699
  export { GxIdeStartPage as gx_ide_start_page };