@yelon/util 16.2.5 → 16.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +22 -22
- package/analysis/global-event.subject.d.ts +7 -7
- package/analysis/index.d.ts +1 -1
- package/array/array-type.service.d.ts +68 -68
- package/array/array.service.d.ts +78 -78
- package/array/index.d.ts +2 -2
- package/browser/cookie.service.d.ts +67 -67
- package/browser/copy.d.ts +6 -6
- package/browser/index.d.ts +5 -5
- package/browser/is-empty.d.ts +6 -6
- package/browser/scroll.service.d.ts +37 -37
- package/browser/style.d.ts +21 -21
- package/config/abc/cell.type.d.ts +118 -0
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/exception.type.d.ts +9 -9
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +18 -17
- package/config/abc/loading.type.d.ts +31 -31
- package/config/abc/lodop.type.d.ts +33 -33
- package/config/abc/media.type.d.ts +11 -11
- package/config/abc/onboarding.type.d.ts +4 -4
- package/config/abc/page-header.type.d.ts +39 -39
- package/config/abc/pdf.type.d.ts +35 -35
- package/config/abc/qr.type.d.ts +25 -25
- package/config/abc/se.type.d.ts +32 -32
- package/config/abc/sg.type.d.ts +10 -10
- package/config/abc/st.type.d.ts +465 -465
- package/config/abc/sv.type.d.ts +14 -14
- package/config/abc/xlsx.type.d.ts +12 -12
- package/config/abc/zip.type.d.ts +10 -10
- package/config/acl/acl.type.d.ts +32 -32
- package/config/auth/auth.type.d.ts +55 -55
- package/config/bis/bis.type.d.ts +11 -11
- package/config/cache/cache.type.d.ts +40 -40
- package/config/chart/chart.type.d.ts +33 -33
- package/config/config.service.d.ts +13 -13
- package/config/config.types.d.ts +49 -48
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/sf/sf.type.d.ts +133 -133
- package/config/socket/socket.type.d.ts +4 -4
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +14 -14
- package/config/theme/index.d.ts +3 -3
- package/config/theme/responsive.type.d.ts +12 -12
- package/config/util/array.type.d.ts +22 -22
- package/config/util/currency.type.d.ts +39 -39
- package/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +31 -29
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/zone-outside.d.ts +35 -35
- package/esm2022/analysis/analysis.mjs +4 -4
- package/esm2022/analysis/global-event.subject.mjs +16 -16
- package/esm2022/analysis/index.mjs +1 -1
- package/esm2022/array/array-type.service.mjs +1 -1
- package/esm2022/array/array.mjs +4 -4
- package/esm2022/array/array.service.mjs +276 -276
- package/esm2022/array/index.mjs +2 -2
- package/esm2022/browser/browser.mjs +4 -4
- package/esm2022/browser/cookie.service.mjs +102 -102
- package/esm2022/browser/copy.mjs +27 -27
- package/esm2022/browser/index.mjs +5 -5
- package/esm2022/browser/is-empty.mjs +18 -18
- package/esm2022/browser/scroll.service.mjs +87 -87
- package/esm2022/browser/style.mjs +37 -37
- package/esm2022/config/abc/cell.type.mjs +2 -0
- package/esm2022/config/abc/date-picker.type.mjs +1 -1
- package/esm2022/config/abc/error-collect.type.mjs +1 -1
- package/esm2022/config/abc/exception.type.mjs +1 -1
- package/esm2022/config/abc/image.type.mjs +1 -1
- package/esm2022/config/abc/index.mjs +19 -18
- package/esm2022/config/abc/loading.type.mjs +1 -1
- package/esm2022/config/abc/lodop.type.mjs +1 -1
- package/esm2022/config/abc/media.type.mjs +1 -1
- package/esm2022/config/abc/onboarding.type.mjs +1 -1
- package/esm2022/config/abc/page-header.type.mjs +1 -1
- package/esm2022/config/abc/pdf.type.mjs +1 -1
- package/esm2022/config/abc/qr.type.mjs +1 -1
- package/esm2022/config/abc/se.type.mjs +1 -1
- package/esm2022/config/abc/sg.type.mjs +1 -1
- package/esm2022/config/abc/st.type.mjs +1 -1
- package/esm2022/config/abc/sv.type.mjs +2 -2
- package/esm2022/config/abc/xlsx.type.mjs +1 -1
- package/esm2022/config/abc/zip.type.mjs +1 -1
- package/esm2022/config/acl/acl.type.mjs +1 -1
- package/esm2022/config/auth/auth.type.mjs +1 -1
- package/esm2022/config/bis/bis.type.mjs +1 -1
- package/esm2022/config/cache/cache.type.mjs +1 -1
- package/esm2022/config/chart/chart.type.mjs +1 -1
- package/esm2022/config/config.mjs +4 -4
- package/esm2022/config/config.service.mjs +36 -36
- package/esm2022/config/config.types.mjs +9 -9
- package/esm2022/config/index.mjs +14 -14
- package/esm2022/config/mock/mock.type.mjs +1 -1
- package/esm2022/config/sf/sf.type.mjs +1 -1
- package/esm2022/config/socket/socket.type.mjs +1 -1
- package/esm2022/config/theme/http.type.mjs +1 -1
- package/esm2022/config/theme/i18n.type.mjs +1 -1
- package/esm2022/config/theme/index.mjs +3 -3
- package/esm2022/config/theme/responsive.type.mjs +1 -1
- package/esm2022/config/util/array.type.mjs +1 -1
- package/esm2022/config/util/currency.type.mjs +1 -1
- package/esm2022/date-time/date-time.mjs +4 -4
- package/esm2022/date-time/index.mjs +2 -2
- package/esm2022/date-time/picker.mjs +115 -115
- package/esm2022/date-time/time.mjs +96 -89
- package/esm2022/decorator/convert.mjs +57 -57
- package/esm2022/decorator/decorator.mjs +4 -4
- package/esm2022/decorator/index.mjs +2 -2
- package/esm2022/decorator/zone-outside.mjs +56 -56
- package/esm2022/form/form.mjs +4 -4
- package/esm2022/form/index.mjs +2 -2
- package/esm2022/form/match-control.mjs +29 -29
- package/esm2022/form/validators.mjs +80 -80
- package/esm2022/format/currency.service.mjs +237 -237
- package/esm2022/format/currency.types.mjs +8 -8
- package/esm2022/format/format.mjs +4 -4
- package/esm2022/format/index.mjs +4 -4
- package/esm2022/format/string.mjs +84 -84
- package/esm2022/format/validate.mjs +93 -93
- package/esm2022/index.mjs +14 -14
- package/esm2022/math/in-range.mjs +24 -24
- package/esm2022/math/index.mjs +2 -2
- package/esm2022/math/math.mjs +4 -4
- package/esm2022/math/round.mjs +52 -52
- package/esm2022/mcache/index.mjs +1 -1
- package/esm2022/mcache/localStorageUtils.mjs +58 -58
- package/esm2022/mcache/mcache.mjs +4 -4
- package/esm2022/mtypes/authority.type.mjs +1 -1
- package/esm2022/mtypes/header-menu.type.mjs +1 -1
- package/esm2022/mtypes/index.mjs +9 -9
- package/esm2022/mtypes/menu.type.mjs +1 -1
- package/esm2022/mtypes/mtypes.mjs +4 -4
- package/esm2022/mtypes/nav.types.mjs +6 -6
- package/esm2022/mtypes/page.mjs +41 -41
- package/esm2022/mtypes/project-info.types.mjs +1 -1
- package/esm2022/mtypes/response.mjs +1 -1
- package/esm2022/mtypes/role.type.mjs +1 -1
- package/esm2022/mtypes/user.types.mjs +1 -1
- package/esm2022/other/assert.mjs +66 -66
- package/esm2022/other/deep.mjs +77 -77
- package/esm2022/other/favicon.mjs +28 -28
- package/esm2022/other/index.mjs +7 -7
- package/esm2022/other/lazy.service.mjs +131 -131
- package/esm2022/other/logger.mjs +32 -32
- package/esm2022/other/other.mjs +4 -4
- package/esm2022/other/path-to-regexp.service.mjs +238 -238
- package/esm2022/other/resize.mjs +3 -3
- package/esm2022/pipes/currency/cny.pipe.mjs +22 -22
- package/esm2022/pipes/currency/index.mjs +4 -4
- package/esm2022/pipes/currency/mega.pipe.mjs +28 -28
- package/esm2022/pipes/currency/module.mjs +18 -18
- package/esm2022/pipes/currency/pipe-currency.mjs +4 -4
- package/esm2022/pipes/currency/price.pipe.mjs +26 -26
- package/esm2022/pipes/filter/filter.pipe.mjs +18 -18
- package/esm2022/pipes/filter/index.mjs +2 -2
- package/esm2022/pipes/filter/module.mjs +16 -16
- package/esm2022/pipes/filter/pipe-filter.mjs +4 -4
- package/esm2022/pipes/format/index.mjs +2 -2
- package/esm2022/pipes/format/mask.pipe.mjs +33 -33
- package/esm2022/pipes/format/module.mjs +16 -16
- package/esm2022/pipes/format/pipe-format.mjs +4 -4
- package/esm2022/pipes/index.mjs +3 -3
- package/esm2022/pipes/pipes.mjs +4 -4
- package/esm2022/token/index.mjs +2 -2
- package/esm2022/token/page-visibility.mjs +14 -14
- package/esm2022/token/token.mjs +4 -4
- package/esm2022/token/window.mjs +16 -16
- package/esm2022/yelon-util.mjs +4 -4
- package/fesm2022/analysis.mjs +24 -24
- package/fesm2022/array.mjs +284 -284
- package/fesm2022/browser.mjs +279 -279
- package/fesm2022/config.mjs +54 -54
- package/fesm2022/config.mjs.map +1 -1
- package/fesm2022/date-time.mjs +218 -211
- package/fesm2022/date-time.mjs.map +1 -1
- package/fesm2022/decorator.mjs +121 -121
- package/fesm2022/form.mjs +118 -118
- package/fesm2022/format.mjs +431 -431
- package/fesm2022/format.mjs.map +1 -1
- package/fesm2022/math.mjs +85 -85
- package/fesm2022/mcache.mjs +65 -65
- package/fesm2022/mtypes.mjs +55 -55
- package/fesm2022/other.mjs +586 -586
- package/fesm2022/pipe-currency.mjs +94 -94
- package/fesm2022/pipe-filter.mjs +40 -40
- package/fesm2022/pipe-format.mjs +55 -55
- package/fesm2022/pipes.mjs +8 -8
- package/fesm2022/token.mjs +37 -37
- package/fesm2022/yelon-util.mjs +19 -19
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/format/currency.service.d.ts +37 -37
- package/format/currency.types.d.ts +82 -77
- package/format/index.d.ts +4 -4
- package/format/string.d.ts +44 -44
- package/format/validate.d.ts +72 -72
- package/index.d.ts +14 -14
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/mcache/index.d.ts +1 -1
- package/mcache/localStorageUtils.d.ts +18 -18
- package/mtypes/authority.type.d.ts +3 -3
- package/mtypes/header-menu.type.d.ts +12 -12
- package/mtypes/index.d.ts +9 -9
- package/mtypes/menu.type.d.ts +40 -40
- package/mtypes/nav.types.d.ts +27 -27
- package/mtypes/page.d.ts +46 -46
- package/mtypes/project-info.types.d.ts +21 -21
- package/mtypes/response.d.ts +7 -7
- package/mtypes/role.type.d.ts +10 -10
- package/mtypes/user.types.d.ts +22 -22
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +35 -35
- package/other/favicon.d.ts +2 -2
- package/other/index.d.ts +7 -7
- package/other/lazy.service.d.ts +48 -48
- package/other/logger.d.ts +5 -5
- package/other/path-to-regexp.service.d.ts +26 -26
- package/other/resize.d.ts +1 -1
- package/package.json +141 -141
- package/pipes/currency/cny.pipe.d.ts +15 -15
- package/pipes/currency/index.d.ts +4 -4
- package/pipes/currency/mega.pipe.d.ts +16 -16
- package/pipes/currency/module.d.ts +9 -9
- package/pipes/currency/price.pipe.d.ts +19 -19
- package/pipes/filter/filter.pipe.d.ts +13 -13
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +7 -7
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +27 -27
- package/pipes/format/module.d.ts +7 -7
- package/pipes/index.d.ts +3 -3
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
@@ -1,116 +1,116 @@
|
|
1
|
-
import { addDays, addSeconds, differenceInCalendarDays, format } from 'date-fns';
|
2
|
-
// TODO: timezone process
|
3
|
-
export class DateTimePickerUtil {
|
4
|
-
/**
|
5
|
-
* Current local time
|
6
|
-
*
|
7
|
-
* 当前本地时间
|
8
|
-
*/
|
9
|
-
get now() {
|
10
|
-
return new Date();
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* Current local date (not including time part)
|
14
|
-
*
|
15
|
-
* 当前本地日期(不包含时间部分)
|
16
|
-
*/
|
17
|
-
get date() {
|
18
|
-
return this.removeTime(this.now);
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* Remove the time part of the date
|
22
|
-
*
|
23
|
-
* 移除日期的时间部分
|
24
|
-
*/
|
25
|
-
removeTime(d) {
|
26
|
-
return new Date(d.toDateString());
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Format date-time
|
30
|
-
*
|
31
|
-
* 格式化日期
|
32
|
-
*/
|
33
|
-
format(d, formatString = 'yyyy-MM-dd HH:mm:ss') {
|
34
|
-
return format(d, formatString);
|
35
|
-
}
|
36
|
-
genTick(count) {
|
37
|
-
return new Array(count).fill(0).map((_, idx) => idx);
|
38
|
-
}
|
39
|
-
/**
|
40
|
-
* Calculate the number of days between two dates, `0` means the same day
|
41
|
-
*
|
42
|
-
* 计算两个日期相差天数,`0` 表示同一天
|
43
|
-
*/
|
44
|
-
getDiffDays(dateLeft, dateRight) {
|
45
|
-
return differenceInCalendarDays(dateLeft, typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date);
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Disabled Before date (Default: today), Generally serves `nzDisabledDate`
|
49
|
-
*
|
50
|
-
* 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`
|
51
|
-
*/
|
52
|
-
disabledBeforeDate(options) {
|
53
|
-
return (d) => this.getDiffDays(d, options?.offsetDays) < 0;
|
54
|
-
}
|
55
|
-
/**
|
56
|
-
* Disabled After date (Default: today), Generally serves `nzDisabledDate`
|
57
|
-
*
|
58
|
-
* 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`
|
59
|
-
*/
|
60
|
-
disabledAfterDate(options) {
|
61
|
-
return (d) => this.getDiffDays(d, options?.offsetDays) > 0;
|
62
|
-
}
|
63
|
-
baseDisabledTime(type, offsetSeconds) {
|
64
|
-
const tick24 = this.genTick(24);
|
65
|
-
const tick60 = this.genTick(60);
|
66
|
-
return (current) => {
|
67
|
-
const cur = current;
|
68
|
-
if (cur == null) {
|
69
|
-
return {};
|
70
|
-
}
|
71
|
-
const now = addSeconds(this.now, offsetSeconds || 0);
|
72
|
-
const nowHours = now.getHours();
|
73
|
-
const nowMinutes = now.getMinutes();
|
74
|
-
const curHours = cur.getHours();
|
75
|
-
const isToday = this.getDiffDays(this.removeTime(cur)) === 0;
|
76
|
-
return {
|
77
|
-
nzDisabledHours: () => {
|
78
|
-
if (!isToday)
|
79
|
-
return [];
|
80
|
-
return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);
|
81
|
-
},
|
82
|
-
nzDisabledMinutes: () => {
|
83
|
-
if (isToday && curHours === nowHours) {
|
84
|
-
return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);
|
85
|
-
}
|
86
|
-
return [];
|
87
|
-
},
|
88
|
-
nzDisabledSeconds: () => {
|
89
|
-
if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {
|
90
|
-
const nowSeconds = now.getSeconds();
|
91
|
-
return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);
|
92
|
-
}
|
93
|
-
return [];
|
94
|
-
}
|
95
|
-
};
|
96
|
-
};
|
97
|
-
}
|
98
|
-
/**
|
99
|
-
* Disabled Before time (Default: now), Generally serves `nzDisabledTime`
|
100
|
-
*
|
101
|
-
* 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`
|
102
|
-
*/
|
103
|
-
disabledBeforeTime(options) {
|
104
|
-
return this.baseDisabledTime('before', options?.offsetSeconds);
|
105
|
-
}
|
106
|
-
/**
|
107
|
-
* Disabled After time (Default: now), Generally serves `nzDisabledTime`
|
108
|
-
*
|
109
|
-
* 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`
|
110
|
-
*/
|
111
|
-
disabledAfterTime(options) {
|
112
|
-
return this.baseDisabledTime('after', options?.offsetSeconds);
|
113
|
-
}
|
114
|
-
}
|
115
|
-
export const dateTimePickerUtil = new DateTimePickerUtil();
|
1
|
+
import { addDays, addSeconds, differenceInCalendarDays, format } from 'date-fns';
|
2
|
+
// TODO: timezone process
|
3
|
+
export class DateTimePickerUtil {
|
4
|
+
/**
|
5
|
+
* Current local time
|
6
|
+
*
|
7
|
+
* 当前本地时间
|
8
|
+
*/
|
9
|
+
get now() {
|
10
|
+
return new Date();
|
11
|
+
}
|
12
|
+
/**
|
13
|
+
* Current local date (not including time part)
|
14
|
+
*
|
15
|
+
* 当前本地日期(不包含时间部分)
|
16
|
+
*/
|
17
|
+
get date() {
|
18
|
+
return this.removeTime(this.now);
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* Remove the time part of the date
|
22
|
+
*
|
23
|
+
* 移除日期的时间部分
|
24
|
+
*/
|
25
|
+
removeTime(d) {
|
26
|
+
return new Date(d.toDateString());
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Format date-time
|
30
|
+
*
|
31
|
+
* 格式化日期
|
32
|
+
*/
|
33
|
+
format(d, formatString = 'yyyy-MM-dd HH:mm:ss') {
|
34
|
+
return format(d, formatString);
|
35
|
+
}
|
36
|
+
genTick(count) {
|
37
|
+
return new Array(count).fill(0).map((_, idx) => idx);
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* Calculate the number of days between two dates, `0` means the same day
|
41
|
+
*
|
42
|
+
* 计算两个日期相差天数,`0` 表示同一天
|
43
|
+
*/
|
44
|
+
getDiffDays(dateLeft, dateRight) {
|
45
|
+
return differenceInCalendarDays(dateLeft, typeof dateRight === 'number' ? addDays(this.date, dateRight) : dateRight || this.date);
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* Disabled Before date (Default: today), Generally serves `nzDisabledDate`
|
49
|
+
*
|
50
|
+
* 禁用之前日期(默认:今天),一般服务于 `nzDisabledDate`
|
51
|
+
*/
|
52
|
+
disabledBeforeDate(options) {
|
53
|
+
return (d) => this.getDiffDays(d, options?.offsetDays) < 0;
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Disabled After date (Default: today), Generally serves `nzDisabledDate`
|
57
|
+
*
|
58
|
+
* 禁用之后日期(默认:今天),一般服务于 `nzDisabledDate`
|
59
|
+
*/
|
60
|
+
disabledAfterDate(options) {
|
61
|
+
return (d) => this.getDiffDays(d, options?.offsetDays) > 0;
|
62
|
+
}
|
63
|
+
baseDisabledTime(type, offsetSeconds) {
|
64
|
+
const tick24 = this.genTick(24);
|
65
|
+
const tick60 = this.genTick(60);
|
66
|
+
return (current) => {
|
67
|
+
const cur = current;
|
68
|
+
if (cur == null) {
|
69
|
+
return {};
|
70
|
+
}
|
71
|
+
const now = addSeconds(this.now, offsetSeconds || 0);
|
72
|
+
const nowHours = now.getHours();
|
73
|
+
const nowMinutes = now.getMinutes();
|
74
|
+
const curHours = cur.getHours();
|
75
|
+
const isToday = this.getDiffDays(this.removeTime(cur)) === 0;
|
76
|
+
return {
|
77
|
+
nzDisabledHours: () => {
|
78
|
+
if (!isToday)
|
79
|
+
return [];
|
80
|
+
return type === 'before' ? tick24.slice(0, nowHours) : tick24.slice(nowHours + 1);
|
81
|
+
},
|
82
|
+
nzDisabledMinutes: () => {
|
83
|
+
if (isToday && curHours === nowHours) {
|
84
|
+
return type === 'before' ? tick60.slice(0, nowMinutes) : tick60.slice(nowMinutes + 1);
|
85
|
+
}
|
86
|
+
return [];
|
87
|
+
},
|
88
|
+
nzDisabledSeconds: () => {
|
89
|
+
if (isToday && curHours === nowHours && cur.getMinutes() === nowMinutes) {
|
90
|
+
const nowSeconds = now.getSeconds();
|
91
|
+
return type === 'before' ? tick60.slice(0, nowSeconds) : tick60.slice(nowSeconds + 1);
|
92
|
+
}
|
93
|
+
return [];
|
94
|
+
}
|
95
|
+
};
|
96
|
+
};
|
97
|
+
}
|
98
|
+
/**
|
99
|
+
* Disabled Before time (Default: now), Generally serves `nzDisabledTime`
|
100
|
+
*
|
101
|
+
* 禁用之前时间(默认:现在),一般服务于 `nzDisabledTime`
|
102
|
+
*/
|
103
|
+
disabledBeforeTime(options) {
|
104
|
+
return this.baseDisabledTime('before', options?.offsetSeconds);
|
105
|
+
}
|
106
|
+
/**
|
107
|
+
* Disabled After time (Default: now), Generally serves `nzDisabledTime`
|
108
|
+
*
|
109
|
+
* 禁用之后时间(默认:现在),一般服务于 `nzDisabledTime`
|
110
|
+
*/
|
111
|
+
disabledAfterTime(options) {
|
112
|
+
return this.baseDisabledTime('after', options?.offsetSeconds);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
export const dateTimePickerUtil = new DateTimePickerUtil();
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3Qgbm93SG91cnMgPSBub3cuZ2V0SG91cnMoKTtcbiAgICAgIGNvbnN0IG5vd01pbnV0ZXMgPSBub3cuZ2V0TWludXRlcygpO1xuICAgICAgY29uc3QgY3VySG91cnMgPSBjdXIuZ2V0SG91cnMoKTtcbiAgICAgIGNvbnN0IGlzVG9kYXkgPSB0aGlzLmdldERpZmZEYXlzKHRoaXMucmVtb3ZlVGltZShjdXIpKSA9PT0gMDtcbiAgICAgIHJldHVybiB7XG4gICAgICAgIG56RGlzYWJsZWRIb3VyczogKCkgPT4ge1xuICAgICAgICAgIGlmICghaXNUb2RheSkgcmV0dXJuIFtdO1xuICAgICAgICAgIHJldHVybiB0eXBlID09PSAnYmVmb3JlJyA/IHRpY2syNC5zbGljZSgwLCBub3dIb3VycykgOiB0aWNrMjQuc2xpY2Uobm93SG91cnMgKyAxKTtcbiAgICAgICAgfSxcbiAgICAgICAgbnpEaXNhYmxlZE1pbnV0ZXM6ICgpID0+IHtcbiAgICAgICAgICBpZiAoaXNUb2RheSAmJiBjdXJIb3VycyA9PT0gbm93SG91cnMpIHtcbiAgICAgICAgICAgIHJldHVybiB0eXBlID09PSAnYmVmb3JlJyA/IHRpY2s2MC5zbGljZSgwLCBub3dNaW51dGVzKSA6IHRpY2s2MC5zbGljZShub3dNaW51dGVzICsgMSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiBbXTtcbiAgICAgICAgfSxcbiAgICAgICAgbnpEaXNhYmxlZFNlY29uZHM6ICgpID0+IHtcbiAgICAgICAgICBpZiAoaXNUb2RheSAmJiBjdXJIb3VycyA9PT0gbm93SG91cnMgJiYgY3VyLmdldE1pbnV0ZXMoKSA9PT0gbm93TWludXRlcykge1xuICAgICAgICAgICAgY29uc3Qgbm93U2Vjb25kcyA9IG5vdy5nZXRTZWNvbmRzKCk7XG4gICAgICAgICAgICByZXR1cm4gdHlwZSA9PT0gJ2JlZm9yZScgPyB0aWNrNjAuc2xpY2UoMCwgbm93U2Vjb25kcykgO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pbCgpO1xuIl19
|
@@ -1,89 +1,96 @@
|
|
1
|
-
import { addDays, endOfDay, endOfMonth, endOfWeek, endOfYear, parse, parseISO, startOfDay, startOfMonth, startOfWeek, startOfYear, subMonths, subWeeks, subYears } from 'date-fns';
|
2
|
-
/**
|
3
|
-
* Get the time range, return `[ Date, Date]` for the start and end dates
|
4
|
-
*
|
5
|
-
* 获取时间范围
|
6
|
-
*
|
7
|
-
* @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数
|
8
|
-
* @param time 开始时间
|
9
|
-
* @param ignoreMaxTime 忽略追加结束日期的最大时间值
|
10
|
-
*/
|
11
|
-
export function getTimeDistance(type, time, options) {
|
12
|
-
time = time
|
13
|
-
? typeof time === 'string'
|
14
|
-
? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())
|
15
|
-
: new Date(time)
|
16
|
-
: new Date();
|
17
|
-
const opt = { weekStartsOn: 1 };
|
18
|
-
let res;
|
19
|
-
switch (type) {
|
20
|
-
case 'today':
|
21
|
-
res = [time, time];
|
22
|
-
break;
|
23
|
-
case '-today':
|
24
|
-
res = [addDays(time, -1), time];
|
25
|
-
break;
|
26
|
-
case 'yesterday':
|
27
|
-
res = [addDays(time, -1), addDays(time, -1)];
|
28
|
-
break;
|
29
|
-
case 'week':
|
30
|
-
res = [startOfWeek(time, opt), endOfWeek(time, opt)];
|
31
|
-
break;
|
32
|
-
case '-week':
|
33
|
-
res = [startOfWeek(subWeeks(time, 1), opt), endOfWeek(subWeeks(time, 1), opt)];
|
34
|
-
break;
|
35
|
-
case 'month':
|
36
|
-
res = [startOfMonth(time), endOfMonth(time)];
|
37
|
-
break;
|
38
|
-
case '-month':
|
39
|
-
res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];
|
40
|
-
break;
|
41
|
-
case 'year':
|
42
|
-
res = [startOfYear(time), endOfYear(time)];
|
43
|
-
break;
|
44
|
-
case '-year':
|
45
|
-
res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];
|
46
|
-
break;
|
47
|
-
default:
|
48
|
-
res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];
|
49
|
-
break;
|
50
|
-
}
|
51
|
-
return options?.ignoreMaxTime ? res : fixEndTimeOfRange(res);
|
52
|
-
}
|
53
|
-
/**
|
54
|
-
* fix time is the most, big value
|
55
|
-
*/
|
56
|
-
export function fixEndTimeOfRange(dates) {
|
57
|
-
return [startOfDay(dates[0]), endOfDay(dates[1])];
|
58
|
-
}
|
59
|
-
/**
|
60
|
-
* Return the date parsed from string using the given format string
|
61
|
-
* - If the argument is a number, it is treated as a timestamp.
|
62
|
-
*
|
63
|
-
* @param formatString If parsing fails try to parse the date by pressing `formatString`
|
64
|
-
* @param defaultValue If parsing fails returned default value, default: `new Date(NaN)`
|
65
|
-
*/
|
66
|
-
export function toDate(value, options) {
|
67
|
-
if (typeof options === 'string')
|
68
|
-
options = { formatString: options };
|
69
|
-
const { formatString, defaultValue } = {
|
70
|
-
formatString: 'yyyy-MM-dd HH:mm:ss',
|
71
|
-
defaultValue: new Date(NaN),
|
72
|
-
...options
|
73
|
-
};
|
74
|
-
if (value == null) {
|
75
|
-
return defaultValue;
|
76
|
-
}
|
77
|
-
if (value instanceof Date) {
|
78
|
-
return value;
|
79
|
-
}
|
80
|
-
if (typeof value === 'number' || (typeof value === 'string' && /[0-9]{10,13}/.test(value))) {
|
81
|
-
return new Date(+value);
|
82
|
-
}
|
83
|
-
let tryDate = parseISO(value);
|
84
|
-
if (isNaN(tryDate)) {
|
85
|
-
tryDate = parse(value, formatString, new Date());
|
86
|
-
}
|
87
|
-
return isNaN(tryDate) ? defaultValue : tryDate;
|
88
|
-
}
|
89
|
-
|
1
|
+
import { addDays, endOfDay, endOfMonth, endOfWeek, endOfYear, parse, parseISO, startOfDay, startOfMonth, startOfWeek, startOfYear, subMonths, subWeeks, subYears, format, formatDistanceToNow } from 'date-fns';
|
2
|
+
/**
|
3
|
+
* Get the time range, return `[ Date, Date]` for the start and end dates
|
4
|
+
*
|
5
|
+
* 获取时间范围
|
6
|
+
*
|
7
|
+
* @param type 类型,带 `-` 表示过去一个时间,若指定 `number` 表示天数
|
8
|
+
* @param time 开始时间
|
9
|
+
* @param ignoreMaxTime 忽略追加结束日期的最大时间值
|
10
|
+
*/
|
11
|
+
export function getTimeDistance(type, time, options) {
|
12
|
+
time = time
|
13
|
+
? typeof time === 'string'
|
14
|
+
? parse(time, 'yyyy-MM-dd HH:mm:ss', new Date())
|
15
|
+
: new Date(time)
|
16
|
+
: new Date();
|
17
|
+
const opt = { weekStartsOn: 1 };
|
18
|
+
let res;
|
19
|
+
switch (type) {
|
20
|
+
case 'today':
|
21
|
+
res = [time, time];
|
22
|
+
break;
|
23
|
+
case '-today':
|
24
|
+
res = [addDays(time, -1), time];
|
25
|
+
break;
|
26
|
+
case 'yesterday':
|
27
|
+
res = [addDays(time, -1), addDays(time, -1)];
|
28
|
+
break;
|
29
|
+
case 'week':
|
30
|
+
res = [startOfWeek(time, opt), endOfWeek(time, opt)];
|
31
|
+
break;
|
32
|
+
case '-week':
|
33
|
+
res = [startOfWeek(subWeeks(time, 1), opt), endOfWeek(subWeeks(time, 1), opt)];
|
34
|
+
break;
|
35
|
+
case 'month':
|
36
|
+
res = [startOfMonth(time), endOfMonth(time)];
|
37
|
+
break;
|
38
|
+
case '-month':
|
39
|
+
res = [startOfMonth(subMonths(time, 1)), endOfMonth(subMonths(time, 1))];
|
40
|
+
break;
|
41
|
+
case 'year':
|
42
|
+
res = [startOfYear(time), endOfYear(time)];
|
43
|
+
break;
|
44
|
+
case '-year':
|
45
|
+
res = [startOfYear(subYears(time, 1)), endOfYear(subYears(time, 1))];
|
46
|
+
break;
|
47
|
+
default:
|
48
|
+
res = type > 0 ? [time, addDays(time, type)] : [addDays(time, type), time];
|
49
|
+
break;
|
50
|
+
}
|
51
|
+
return options?.ignoreMaxTime ? res : fixEndTimeOfRange(res);
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* fix time is the most, big value
|
55
|
+
*/
|
56
|
+
export function fixEndTimeOfRange(dates) {
|
57
|
+
return [startOfDay(dates[0]), endOfDay(dates[1])];
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Return the date parsed from string using the given format string
|
61
|
+
* - If the argument is a number, it is treated as a timestamp.
|
62
|
+
*
|
63
|
+
* @param formatString If parsing fails try to parse the date by pressing `formatString`
|
64
|
+
* @param defaultValue If parsing fails returned default value, default: `new Date(NaN)`
|
65
|
+
*/
|
66
|
+
export function toDate(value, options) {
|
67
|
+
if (typeof options === 'string')
|
68
|
+
options = { formatString: options };
|
69
|
+
const { formatString, defaultValue } = {
|
70
|
+
formatString: 'yyyy-MM-dd HH:mm:ss',
|
71
|
+
defaultValue: new Date(NaN),
|
72
|
+
...options
|
73
|
+
};
|
74
|
+
if (value == null) {
|
75
|
+
return defaultValue;
|
76
|
+
}
|
77
|
+
if (value instanceof Date) {
|
78
|
+
return value;
|
79
|
+
}
|
80
|
+
if (typeof value === 'number' || (typeof value === 'string' && /[0-9]{10,13}/.test(value))) {
|
81
|
+
return new Date(+value);
|
82
|
+
}
|
83
|
+
let tryDate = parseISO(value);
|
84
|
+
if (isNaN(tryDate)) {
|
85
|
+
tryDate = parse(value, formatString, new Date());
|
86
|
+
}
|
87
|
+
return isNaN(tryDate) ? defaultValue : tryDate;
|
88
|
+
}
|
89
|
+
export function formatDate(value, formatString, dateLocale) {
|
90
|
+
value = toDate(value);
|
91
|
+
if (isNaN(value))
|
92
|
+
return '';
|
93
|
+
const langOpt = { locale: dateLocale };
|
94
|
+
return formatString === 'fn' ? formatDistanceToNow(value, langOpt) : format(value, formatString, langOpt);
|
95
|
+
}
|
96
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZGF0ZS10aW1lL3RpbWUudHMiX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xuICBpZiAodmFsdWUgaW5zdGFuY2VvZiBEYXRlKSB7XG4gICAgcmV0dXJuIHZhbHVlO1xuICB9XG4gIGlmICh0eXBlb2YgdmFsdWUgPT09ICdudW1iZXInIHx8ICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnICYmIC9bMC05XXsxMCwxM30vLnRlc3QodmFsdWUpKSkge1xuICAgIHJldHVybiBuZXcgRGF0ZSgrdmFsdWUpO1xuICB9XG4gIGxldCB0cnlEYXRlID0gcGFyc2VJU08odmFsdWUpO1xuICBpZiAoaXNOYU4odHJ5RGF0ZSBhcyBOelNhZmVBbnkpKSB7XG4gICAgdHJ5RGF0ZSA9IHBhcnNlKHZhbHVlLCBmb3JtYXRTdHJpbmchLCBuZXcgRGF0ZSgpKTtcbiAgfVxuXG4gIHJldHVybiBpc05hTih0cnlEYXRlIGFzIE56U2FmZUFueSkgPyBkZWZhdWx0VmFsdWUgOiB0cnlEYXRlO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gZm9ybWF0RGF0ZSh2YWx1ZTogRGF0ZSB8IHN0cmluZyB8IG51bWJlciwgZm9ybWF0U3RyaW5nOiBzdHJpbmcsIGRhdGVMb2NhbGU/OiBEYXRlTG9jYWxlKTogc3RyaW5nIHtcbiAgdmFsdWUgPSB0b0RhdGUodmFsdWUpO1xuICBpZiAoaXNOYU4odmFsdWUgYXMgTnpTYWZlQW55KSkgcmV0dXJuICcnO1xuXG4gIGNvbnN0IGxhbmdPcHQgPSB7IGxvY2FsZTogZGF0ZUxvY2FsZSB9O1xuICByZXR1cm4gZm9ybWF0U3RyaW5nID09PSAnZm4nID8gZm9ybWF0RGlzdGFuY2VUb05vdyh2YWx1ZSwgbGFuZ09wdCkgOiBmb3JtYXQodmFsdWUsIGZvcm1hdFN0cmluZywgbGFuZ09wdCk7XG59XG4iXX0=
|
@@ -1,58 +1,58 @@
|
|
1
|
-
import { warn } from '@yelon/util/other';
|
2
|
-
function propDecoratorFactory(name, fallback, defaultValue) {
|
3
|
-
function propDecorator(target, propName, originalDescriptor) {
|
4
|
-
const privatePropName = `$$__${propName}`;
|
5
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
6
|
-
if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
|
7
|
-
warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
|
8
|
-
}
|
9
|
-
}
|
10
|
-
Object.defineProperty(target, privatePropName, {
|
11
|
-
configurable: true,
|
12
|
-
writable: true
|
13
|
-
});
|
14
|
-
return {
|
15
|
-
get() {
|
16
|
-
return originalDescriptor && originalDescriptor.get
|
17
|
-
? originalDescriptor.get.bind(this)()
|
18
|
-
: this[privatePropName];
|
19
|
-
},
|
20
|
-
set(value) {
|
21
|
-
if (originalDescriptor && originalDescriptor.set) {
|
22
|
-
originalDescriptor.set.bind(this)(fallback(value, defaultValue));
|
23
|
-
}
|
24
|
-
this[privatePropName] = fallback(value, defaultValue);
|
25
|
-
}
|
26
|
-
};
|
27
|
-
}
|
28
|
-
return propDecorator;
|
29
|
-
}
|
30
|
-
export function toBoolean(value, defaultValue = false) {
|
31
|
-
return value == null ? defaultValue : `${value}` !== 'false';
|
32
|
-
}
|
33
|
-
/**
|
34
|
-
* Input decorator that handle a prop to do get/set automatically with toBoolean
|
35
|
-
*
|
36
|
-
* ```ts
|
37
|
-
* {AT}Input() {AT}InputBoolean() visible: boolean = false;
|
38
|
-
* {AT}Input() {AT}InputBoolean(null) visible: boolean = false;
|
39
|
-
* ```
|
40
|
-
*/
|
41
|
-
export function InputBoolean(defaultValue = false) {
|
42
|
-
return propDecoratorFactory('InputBoolean', toBoolean, defaultValue);
|
43
|
-
}
|
44
|
-
export function toNumber(value, fallbackValue = 0) {
|
45
|
-
return !isNaN(parseFloat(value)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Input decorator that handle a prop to do get/set automatically with toNumber
|
49
|
-
*
|
50
|
-
* ```ts
|
51
|
-
* {AT}Input() {AT}InputNumber() visible: number = 1;
|
52
|
-
* {AT}Input() {AT}InputNumber(null) visible: number = 2;
|
53
|
-
* ```
|
54
|
-
*/
|
55
|
-
export function InputNumber(defaultValue = 0) {
|
56
|
-
return propDecoratorFactory('InputNumber', toNumber, defaultValue);
|
57
|
-
}
|
1
|
+
import { warn } from '@yelon/util/other';
|
2
|
+
function propDecoratorFactory(name, fallback, defaultValue) {
|
3
|
+
function propDecorator(target, propName, originalDescriptor) {
|
4
|
+
const privatePropName = `$$__${propName}`;
|
5
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
6
|
+
if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
|
7
|
+
warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
Object.defineProperty(target, privatePropName, {
|
11
|
+
configurable: true,
|
12
|
+
writable: true
|
13
|
+
});
|
14
|
+
return {
|
15
|
+
get() {
|
16
|
+
return originalDescriptor && originalDescriptor.get
|
17
|
+
? originalDescriptor.get.bind(this)()
|
18
|
+
: this[privatePropName];
|
19
|
+
},
|
20
|
+
set(value) {
|
21
|
+
if (originalDescriptor && originalDescriptor.set) {
|
22
|
+
originalDescriptor.set.bind(this)(fallback(value, defaultValue));
|
23
|
+
}
|
24
|
+
this[privatePropName] = fallback(value, defaultValue);
|
25
|
+
}
|
26
|
+
};
|
27
|
+
}
|
28
|
+
return propDecorator;
|
29
|
+
}
|
30
|
+
export function toBoolean(value, defaultValue = false) {
|
31
|
+
return value == null ? defaultValue : `${value}` !== 'false';
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Input decorator that handle a prop to do get/set automatically with toBoolean
|
35
|
+
*
|
36
|
+
* ```ts
|
37
|
+
* {AT}Input() {AT}InputBoolean() visible: boolean = false;
|
38
|
+
* {AT}Input() {AT}InputBoolean(null) visible: boolean = false;
|
39
|
+
* ```
|
40
|
+
*/
|
41
|
+
export function InputBoolean(defaultValue = false) {
|
42
|
+
return propDecoratorFactory('InputBoolean', toBoolean, defaultValue);
|
43
|
+
}
|
44
|
+
export function toNumber(value, fallbackValue = 0) {
|
45
|
+
return !isNaN(parseFloat(value)) && !isNaN(Number(value)) ? Number(value) : fallbackValue;
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* Input decorator that handle a prop to do get/set automatically with toNumber
|
49
|
+
*
|
50
|
+
* ```ts
|
51
|
+
* {AT}Input() {AT}InputNumber() visible: number = 1;
|
52
|
+
* {AT}Input() {AT}InputNumber(null) visible: number = 2;
|
53
|
+
* ```
|
54
|
+
*/
|
55
|
+
export function InputNumber(defaultValue = 0) {
|
56
|
+
return propDecoratorFactory('InputNumber', toNumber, defaultValue);
|
57
|
+
}
|
58
58
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZGVjb3JhdG9yL2NvbnZlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBTXpDLFNBQVMsb0JBQW9CLENBQzNCLElBQVksRUFDWixRQUFzQyxFQUN0QyxZQUF1QjtJQUV2QixTQUFTLGFBQWEsQ0FDcEIsTUFBaUIsRUFDakIsUUFBZ0IsRUFDaEIsa0JBQXVEO1FBRXZELE1BQU0sZUFBZSxHQUFHLE9BQU8sUUFBUSxFQUFFLENBQUM7UUFFMUMsSUFBSSxPQUFPLFNBQVMsS0FBSyxXQUFXLElBQUksU0FBUyxFQUFFO1lBQ2pELElBQUksTUFBTSxDQUFDLFNBQVMsQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxlQUFlLENBQUMsRUFBRTtnQkFDakUsSUFBSSxDQUFDLGFBQWEsZUFBZ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 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* Generated bundle index. Do not edit.
|
3
|
-
*/
|
4
|
-
export * from './index';
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './index';
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVjb3JhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9kZWNvcmF0b3IvZGVjb3JhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from './convert';
|
2
|
-
export * from './zone-outside';
|
1
|
+
export * from './convert';
|
2
|
+
export * from './zone-outside';
|
3
3
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2RlY29yYXRvci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLGdCQUFnQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9jb252ZXJ0JztcbmV4cG9ydCAqIGZyb20gJy4vem9uZS1vdXRzaWRlJztcbiJdfQ==
|