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