@yelon/util 16.2.5 → 16.3.1
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,238 +1,238 @@
|
|
1
|
-
import { CurrencyPipe, formatNumber } from '@angular/common';
|
2
|
-
import { DEFAULT_CURRENCY_CODE, Inject, Injectable, LOCALE_ID } from '@angular/core';
|
3
|
-
import { CurrencyMega_Powers } from './currency.types';
|
4
|
-
import * as i0 from "@angular/core";
|
5
|
-
import * as i1 from "@yelon/util/config";
|
6
|
-
export class CurrencyService {
|
7
|
-
constructor(cog, locale, _defaultCurrencyCode = 'USD') {
|
8
|
-
this.locale = locale;
|
9
|
-
this.currencyPipe = new CurrencyPipe(locale, _defaultCurrencyCode);
|
10
|
-
this.c = cog.merge('utilCurrency', {
|
11
|
-
startingUnit: 'yuan',
|
12
|
-
megaUnit: { Q: '京', T: '兆', B: '亿', M: '万', K: '千' },
|
13
|
-
precision: 2,
|
14
|
-
ignoreZeroPrecision: true
|
15
|
-
});
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* Format a number with commas as thousands separators
|
19
|
-
*
|
20
|
-
* 格式化货币,用逗号将数字格式化为千位分隔符
|
21
|
-
* ```ts
|
22
|
-
* 10000 => `10,000`
|
23
|
-
* 10000.567 => `10,000.57`
|
24
|
-
* ```
|
25
|
-
*/
|
26
|
-
format(value, options) {
|
27
|
-
options = {
|
28
|
-
startingUnit: this.c.startingUnit,
|
29
|
-
precision: this.c.precision,
|
30
|
-
ignoreZeroPrecision: this.c.ignoreZeroPrecision,
|
31
|
-
ngCurrency: this.c.ngCurrency,
|
32
|
-
...options
|
33
|
-
};
|
34
|
-
let truthValue = Number(value);
|
35
|
-
if (value == null || isNaN(truthValue)) {
|
36
|
-
return '';
|
37
|
-
}
|
38
|
-
if (options.startingUnit === 'cent') {
|
39
|
-
truthValue = truthValue / 100;
|
40
|
-
}
|
41
|
-
if (options.ngCurrency != null) {
|
42
|
-
const cur = options.ngCurrency;
|
43
|
-
return this.currencyPipe.transform(truthValue, cur.currencyCode, cur.display, cur.digitsInfo, cur.locale || this.locale);
|
44
|
-
}
|
45
|
-
const res = formatNumber(truthValue, this.locale, `.${options.ignoreZeroPrecision ? 1 : options.precision}-${options.precision}`);
|
46
|
-
return options.ignoreZeroPrecision ? res.replace(/(?:\.[0]+)$/g, '') : res;
|
47
|
-
}
|
48
|
-
/**
|
49
|
-
* Large number format filter
|
50
|
-
*
|
51
|
-
* 大数据格式化
|
52
|
-
* ```ts
|
53
|
-
* 1000 => { value: '1', unit: 'K', unitI18n: '千' }
|
54
|
-
* 12456 => { value: '12.46', unit: 'K', unitI18n: '千' }
|
55
|
-
* ```
|
56
|
-
*/
|
57
|
-
mega(value, options) {
|
58
|
-
options = { precision: this.c.precision, unitI18n: this.c.megaUnit, startingUnit: this.c.startingUnit, ...options };
|
59
|
-
let num = Number(value);
|
60
|
-
const res = { raw: value, value: '', unit: '', unitI18n: '' };
|
61
|
-
if (isNaN(num) || num === 0) {
|
62
|
-
res.value = value.toString();
|
63
|
-
return res;
|
64
|
-
}
|
65
|
-
if (options.startingUnit === 'cent') {
|
66
|
-
num = num / 100;
|
67
|
-
}
|
68
|
-
let abs = Math.abs(+num);
|
69
|
-
const rounder = Math.pow(10, options.precision);
|
70
|
-
const isNegative = num < 0;
|
71
|
-
for (const p of CurrencyMega_Powers) {
|
72
|
-
let reduced = abs / p.value;
|
73
|
-
reduced = Math.round(reduced * rounder) / rounder;
|
74
|
-
if (reduced >= 1) {
|
75
|
-
abs = reduced;
|
76
|
-
res.unit = p.unit;
|
77
|
-
break;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
res.value = (isNegative ? '-' : '') + abs;
|
81
|
-
res.unitI18n = options.unitI18n[res.unit];
|
82
|
-
return res;
|
83
|
-
}
|
84
|
-
/**
|
85
|
-
* Converted into RMB notation.
|
86
|
-
*
|
87
|
-
* 转化成人民币表示法
|
88
|
-
*/
|
89
|
-
cny(value, options) {
|
90
|
-
options = {
|
91
|
-
inWords: true,
|
92
|
-
minusSymbol: '负',
|
93
|
-
startingUnit: this.c.startingUnit,
|
94
|
-
...options
|
95
|
-
};
|
96
|
-
value = Number(value);
|
97
|
-
if (isNaN(value)) {
|
98
|
-
return '';
|
99
|
-
}
|
100
|
-
if (options.startingUnit === 'cent') {
|
101
|
-
value = value / 100;
|
102
|
-
}
|
103
|
-
value = value.toString();
|
104
|
-
let integer;
|
105
|
-
let decimal;
|
106
|
-
[integer, decimal] = value.split('.');
|
107
|
-
let symbol = '';
|
108
|
-
if (integer.startsWith('-')) {
|
109
|
-
symbol = options.minusSymbol;
|
110
|
-
integer = integer.substring(1);
|
111
|
-
}
|
112
|
-
if (/^-?\d+$/.test(value)) {
|
113
|
-
decimal = null;
|
114
|
-
}
|
115
|
-
integer = (+integer).toString();
|
116
|
-
const inWords = options.inWords;
|
117
|
-
const unit = {
|
118
|
-
num: inWords
|
119
|
-
? ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '点']
|
120
|
-
: ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '点'],
|
121
|
-
radice: inWords
|
122
|
-
? [
|
123
|
-
'',
|
124
|
-
'拾',
|
125
|
-
'佰',
|
126
|
-
'仟',
|
127
|
-
'万',
|
128
|
-
'拾',
|
129
|
-
'佰',
|
130
|
-
'仟',
|
131
|
-
'亿',
|
132
|
-
'拾',
|
133
|
-
'佰',
|
134
|
-
'仟',
|
135
|
-
'万亿',
|
136
|
-
'拾',
|
137
|
-
'佰',
|
138
|
-
'仟',
|
139
|
-
'兆',
|
140
|
-
'拾',
|
141
|
-
'佰',
|
142
|
-
'仟'
|
143
|
-
]
|
144
|
-
: [
|
145
|
-
'',
|
146
|
-
'十',
|
147
|
-
'百',
|
148
|
-
'千',
|
149
|
-
'万',
|
150
|
-
'十',
|
151
|
-
'百',
|
152
|
-
'千',
|
153
|
-
'亿',
|
154
|
-
'十',
|
155
|
-
'百',
|
156
|
-
'千',
|
157
|
-
'万亿',
|
158
|
-
'十',
|
159
|
-
'百',
|
160
|
-
'千',
|
161
|
-
'兆',
|
162
|
-
'十',
|
163
|
-
'百',
|
164
|
-
'千'
|
165
|
-
],
|
166
|
-
dec: ['角', '分', '厘', '毫']
|
167
|
-
};
|
168
|
-
if (inWords) {
|
169
|
-
value = (+value).toFixed(5).toString();
|
170
|
-
}
|
171
|
-
let integerRes = '';
|
172
|
-
const integerCount = integer.length;
|
173
|
-
if (integer === '0' || integerCount === 0) {
|
174
|
-
integerRes = '零';
|
175
|
-
}
|
176
|
-
else {
|
177
|
-
let cnDesc = '';
|
178
|
-
for (let i = 0; i < integerCount; i++) {
|
179
|
-
const n = +integer[i];
|
180
|
-
const j = integerCount - i - 1;
|
181
|
-
const isZero = i > 1 && n !== 0 && integer[i - 1] === '0';
|
182
|
-
const cnZero = isZero ? '零' : '';
|
183
|
-
const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substring(i - 3, i - 3 + 4) === '0000';
|
184
|
-
const descMark = cnDesc;
|
185
|
-
let cnNum = unit.num[n];
|
186
|
-
cnDesc = isEmpptyUnit ? '' : unit.radice[j];
|
187
|
-
// 第一位是一十
|
188
|
-
if (i === 0 && cnNum === '一' && cnDesc === '十')
|
189
|
-
cnNum = '';
|
190
|
-
const isChangeEr = n > 1 &&
|
191
|
-
cnNum === '二' && // 去除首位
|
192
|
-
['', '十', '百'].indexOf(cnDesc) === -1 && // 不读两\两十\两百
|
193
|
-
descMark !== '十'; // 不读十两
|
194
|
-
if (isChangeEr)
|
195
|
-
cnNum = '两';
|
196
|
-
integerRes += cnZero + cnNum + cnDesc;
|
197
|
-
}
|
198
|
-
}
|
199
|
-
// 小数部分拼接
|
200
|
-
let decimalRes = '';
|
201
|
-
const decimalCount = decimal ? decimal.toString().length : 0;
|
202
|
-
if (decimal === null) {
|
203
|
-
decimalRes = inWords ? '整' : '';
|
204
|
-
}
|
205
|
-
else if (decimal === '0') {
|
206
|
-
decimalRes = '零';
|
207
|
-
}
|
208
|
-
else {
|
209
|
-
for (let i = 0; i < decimalCount; i++) {
|
210
|
-
if (inWords && i > unit.dec.length - 1)
|
211
|
-
break;
|
212
|
-
const n = decimal[i];
|
213
|
-
const cnZero = n === '0' ? '零' : '';
|
214
|
-
const cnNum = unit.num[+n];
|
215
|
-
const cnDesc = inWords ? unit.dec[i] : '';
|
216
|
-
decimalRes += cnZero + cnNum + cnDesc;
|
217
|
-
}
|
218
|
-
}
|
219
|
-
const ret = symbol +
|
220
|
-
(inWords
|
221
|
-
? integerRes + (decimalRes === '零' ? '元整' : `元${decimalRes}`)
|
222
|
-
: integerRes + (decimalRes === '' ? '' : `点${decimalRes}`));
|
223
|
-
return ret;
|
224
|
-
}
|
225
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
226
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
227
|
-
}
|
228
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
229
|
-
type: Injectable,
|
230
|
-
args: [{ providedIn: 'root' }]
|
231
|
-
}], ctorParameters: function () { return [{ type: i1.YunzaiConfigService }, { type: undefined, decorators: [{
|
232
|
-
type: Inject,
|
233
|
-
args: [LOCALE_ID]
|
234
|
-
}] }, { type: undefined, decorators: [{
|
235
|
-
type: Inject,
|
236
|
-
args: [DEFAULT_CURRENCY_CODE]
|
237
|
-
}] }]; } });
|
1
|
+
import { CurrencyPipe, formatNumber } from '@angular/common';
|
2
|
+
import { DEFAULT_CURRENCY_CODE, Inject, Injectable, LOCALE_ID } from '@angular/core';
|
3
|
+
import { CurrencyMega_Powers } from './currency.types';
|
4
|
+
import * as i0 from "@angular/core";
|
5
|
+
import * as i1 from "@yelon/util/config";
|
6
|
+
export class CurrencyService {
|
7
|
+
constructor(cog, locale, _defaultCurrencyCode = 'USD') {
|
8
|
+
this.locale = locale;
|
9
|
+
this.currencyPipe = new CurrencyPipe(locale, _defaultCurrencyCode);
|
10
|
+
this.c = cog.merge('utilCurrency', {
|
11
|
+
startingUnit: 'yuan',
|
12
|
+
megaUnit: { Q: '京', T: '兆', B: '亿', M: '万', K: '千' },
|
13
|
+
precision: 2,
|
14
|
+
ignoreZeroPrecision: true
|
15
|
+
});
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Format a number with commas as thousands separators
|
19
|
+
*
|
20
|
+
* 格式化货币,用逗号将数字格式化为千位分隔符
|
21
|
+
* ```ts
|
22
|
+
* 10000 => `10,000`
|
23
|
+
* 10000.567 => `10,000.57`
|
24
|
+
* ```
|
25
|
+
*/
|
26
|
+
format(value, options) {
|
27
|
+
options = {
|
28
|
+
startingUnit: this.c.startingUnit,
|
29
|
+
precision: this.c.precision,
|
30
|
+
ignoreZeroPrecision: this.c.ignoreZeroPrecision,
|
31
|
+
ngCurrency: this.c.ngCurrency,
|
32
|
+
...options
|
33
|
+
};
|
34
|
+
let truthValue = Number(value);
|
35
|
+
if (value == null || isNaN(truthValue)) {
|
36
|
+
return '';
|
37
|
+
}
|
38
|
+
if (options.startingUnit === 'cent') {
|
39
|
+
truthValue = truthValue / 100;
|
40
|
+
}
|
41
|
+
if (options.ngCurrency != null) {
|
42
|
+
const cur = options.ngCurrency;
|
43
|
+
return this.currencyPipe.transform(truthValue, cur.currencyCode, cur.display, cur.digitsInfo, cur.locale || this.locale);
|
44
|
+
}
|
45
|
+
const res = formatNumber(truthValue, this.locale, `.${options.ignoreZeroPrecision ? 1 : options.precision}-${options.precision}`);
|
46
|
+
return options.ignoreZeroPrecision ? res.replace(/(?:\.[0]+)$/g, '') : res;
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Large number format filter
|
50
|
+
*
|
51
|
+
* 大数据格式化
|
52
|
+
* ```ts
|
53
|
+
* 1000 => { value: '1', unit: 'K', unitI18n: '千' }
|
54
|
+
* 12456 => { value: '12.46', unit: 'K', unitI18n: '千' }
|
55
|
+
* ```
|
56
|
+
*/
|
57
|
+
mega(value, options) {
|
58
|
+
options = { precision: this.c.precision, unitI18n: this.c.megaUnit, startingUnit: this.c.startingUnit, ...options };
|
59
|
+
let num = Number(value);
|
60
|
+
const res = { raw: value, value: '', unit: '', unitI18n: '' };
|
61
|
+
if (isNaN(num) || num === 0) {
|
62
|
+
res.value = value.toString();
|
63
|
+
return res;
|
64
|
+
}
|
65
|
+
if (options.startingUnit === 'cent') {
|
66
|
+
num = num / 100;
|
67
|
+
}
|
68
|
+
let abs = Math.abs(+num);
|
69
|
+
const rounder = Math.pow(10, options.precision);
|
70
|
+
const isNegative = num < 0;
|
71
|
+
for (const p of CurrencyMega_Powers) {
|
72
|
+
let reduced = abs / p.value;
|
73
|
+
reduced = Math.round(reduced * rounder) / rounder;
|
74
|
+
if (reduced >= 1) {
|
75
|
+
abs = reduced;
|
76
|
+
res.unit = p.unit;
|
77
|
+
break;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
res.value = (isNegative ? '-' : '') + abs;
|
81
|
+
res.unitI18n = options.unitI18n[res.unit];
|
82
|
+
return res;
|
83
|
+
}
|
84
|
+
/**
|
85
|
+
* Converted into RMB notation.
|
86
|
+
*
|
87
|
+
* 转化成人民币表示法
|
88
|
+
*/
|
89
|
+
cny(value, options) {
|
90
|
+
options = {
|
91
|
+
inWords: true,
|
92
|
+
minusSymbol: '负',
|
93
|
+
startingUnit: this.c.startingUnit,
|
94
|
+
...options
|
95
|
+
};
|
96
|
+
value = Number(value);
|
97
|
+
if (isNaN(value)) {
|
98
|
+
return '';
|
99
|
+
}
|
100
|
+
if (options.startingUnit === 'cent') {
|
101
|
+
value = value / 100;
|
102
|
+
}
|
103
|
+
value = value.toString();
|
104
|
+
let integer;
|
105
|
+
let decimal;
|
106
|
+
[integer, decimal] = value.split('.');
|
107
|
+
let symbol = '';
|
108
|
+
if (integer.startsWith('-')) {
|
109
|
+
symbol = options.minusSymbol;
|
110
|
+
integer = integer.substring(1);
|
111
|
+
}
|
112
|
+
if (/^-?\d+$/.test(value)) {
|
113
|
+
decimal = null;
|
114
|
+
}
|
115
|
+
integer = (+integer).toString();
|
116
|
+
const inWords = options.inWords;
|
117
|
+
const unit = {
|
118
|
+
num: inWords
|
119
|
+
? ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '点']
|
120
|
+
: ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '点'],
|
121
|
+
radice: inWords
|
122
|
+
? [
|
123
|
+
'',
|
124
|
+
'拾',
|
125
|
+
'佰',
|
126
|
+
'仟',
|
127
|
+
'万',
|
128
|
+
'拾',
|
129
|
+
'佰',
|
130
|
+
'仟',
|
131
|
+
'亿',
|
132
|
+
'拾',
|
133
|
+
'佰',
|
134
|
+
'仟',
|
135
|
+
'万亿',
|
136
|
+
'拾',
|
137
|
+
'佰',
|
138
|
+
'仟',
|
139
|
+
'兆',
|
140
|
+
'拾',
|
141
|
+
'佰',
|
142
|
+
'仟'
|
143
|
+
]
|
144
|
+
: [
|
145
|
+
'',
|
146
|
+
'十',
|
147
|
+
'百',
|
148
|
+
'千',
|
149
|
+
'万',
|
150
|
+
'十',
|
151
|
+
'百',
|
152
|
+
'千',
|
153
|
+
'亿',
|
154
|
+
'十',
|
155
|
+
'百',
|
156
|
+
'千',
|
157
|
+
'万亿',
|
158
|
+
'十',
|
159
|
+
'百',
|
160
|
+
'千',
|
161
|
+
'兆',
|
162
|
+
'十',
|
163
|
+
'百',
|
164
|
+
'千'
|
165
|
+
],
|
166
|
+
dec: ['角', '分', '厘', '毫']
|
167
|
+
};
|
168
|
+
if (inWords) {
|
169
|
+
value = (+value).toFixed(5).toString();
|
170
|
+
}
|
171
|
+
let integerRes = '';
|
172
|
+
const integerCount = integer.length;
|
173
|
+
if (integer === '0' || integerCount === 0) {
|
174
|
+
integerRes = '零';
|
175
|
+
}
|
176
|
+
else {
|
177
|
+
let cnDesc = '';
|
178
|
+
for (let i = 0; i < integerCount; i++) {
|
179
|
+
const n = +integer[i];
|
180
|
+
const j = integerCount - i - 1;
|
181
|
+
const isZero = i > 1 && n !== 0 && integer[i - 1] === '0';
|
182
|
+
const cnZero = isZero ? '零' : '';
|
183
|
+
const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substring(i - 3, i - 3 + 4) === '0000';
|
184
|
+
const descMark = cnDesc;
|
185
|
+
let cnNum = unit.num[n];
|
186
|
+
cnDesc = isEmpptyUnit ? '' : unit.radice[j];
|
187
|
+
// 第一位是一十
|
188
|
+
if (i === 0 && cnNum === '一' && cnDesc === '十')
|
189
|
+
cnNum = '';
|
190
|
+
const isChangeEr = n > 1 &&
|
191
|
+
cnNum === '二' && // 去除首位
|
192
|
+
['', '十', '百'].indexOf(cnDesc) === -1 && // 不读两\两十\两百
|
193
|
+
descMark !== '十'; // 不读十两
|
194
|
+
if (isChangeEr)
|
195
|
+
cnNum = '两';
|
196
|
+
integerRes += cnZero + cnNum + cnDesc;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
// 小数部分拼接
|
200
|
+
let decimalRes = '';
|
201
|
+
const decimalCount = decimal ? decimal.toString().length : 0;
|
202
|
+
if (decimal === null) {
|
203
|
+
decimalRes = inWords ? '整' : '';
|
204
|
+
}
|
205
|
+
else if (decimal === '0') {
|
206
|
+
decimalRes = '零';
|
207
|
+
}
|
208
|
+
else {
|
209
|
+
for (let i = 0; i < decimalCount; i++) {
|
210
|
+
if (inWords && i > unit.dec.length - 1)
|
211
|
+
break;
|
212
|
+
const n = decimal[i];
|
213
|
+
const cnZero = n === '0' ? '零' : '';
|
214
|
+
const cnNum = unit.num[+n];
|
215
|
+
const cnDesc = inWords ? unit.dec[i] : '';
|
216
|
+
decimalRes += cnZero + cnNum + cnDesc;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
const ret = symbol +
|
220
|
+
(inWords
|
221
|
+
? integerRes + (decimalRes === '零' ? '元整' : `元${decimalRes}`)
|
222
|
+
: integerRes + (decimalRes === '' ? '' : `点${decimalRes}`));
|
223
|
+
return ret;
|
224
|
+
}
|
225
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: CurrencyService, deps: [{ token: i1.YunzaiConfigService }, { token: LOCALE_ID }, { token: DEFAULT_CURRENCY_CODE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
226
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: CurrencyService, providedIn: 'root' }); }
|
227
|
+
}
|
228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: CurrencyService, decorators: [{
|
229
|
+
type: Injectable,
|
230
|
+
args: [{ providedIn: 'root' }]
|
231
|
+
}], ctorParameters: function () { return [{ type: i1.YunzaiConfigService }, { type: undefined, decorators: [{
|
232
|
+
type: Inject,
|
233
|
+
args: [LOCALE_ID]
|
234
|
+
}] }, { type: undefined, decorators: [{
|
235
|
+
type: Inject,
|
236
|
+
args: [DEFAULT_CURRENCY_CODE]
|
237
|
+
}] }]; } });
|
238
238
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmV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+mZhicsICfmn5InLCAn5o2MJywgJ+eOlicsICfngrknXVxuICAgICAgICA6IFsnJywgJ+S4gCcsICfkuownLCAn5LiJJywgJ+WbmycsICfkupQnLCAn5YWtJywgJ+S4gycsICflhasnLCAn5LmdJywgJ+eCuSddLFxuICAgICAgcmFkaWNlOiBpbldvcmRzXG4gICAgICAgID8gW1xuICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAn5ou+JyxcbiAgICAgICAgICAgICfkvbAnLFxuICAgICAgICAgICAgJ+S7nycsXG4gICAgICAgICAgICAn5LiHJyxcbiAgICAgICAgICAgICfmi74nLFxuICAgICAgICAgICAgJ+S9sCcsXG4gICAgICAgICAgICAn5LufJyxcbiAgICAgICAgICAgICfkur8nLFxuICAgICAgICAgICAgJ+aLvicsXG4gICAgICAgICAgICAn5L2wJyxcbiAgICAgICAgICAgICfku58nLFxuICAgICAgICAgICAgJ+S4h+S6vycsXG4gICAgICAgICAgICAn5ou+JyxcbiAgICAgICAgICAgICfkvbAnLFxuICAgICAgICAgICAgJ+S7nycsXG4gICAgICAgICAgICAn5YWGJyxcbiAgICAgICAgICAgICfmi74nLFxuICAgICAgICAgICAgJ+S9sCcsXG4gICAgICAgICAgICAn5LufJ1xuICAgICAgICAgIF1cbiAgICAgICAgOiBbXG4gICAgICAgICAgICAnJyxcbiAgICAgICAgICAgICfljYEnLFxuICAgICAgICAgICAgJ+eZvicsXG4gICAgICAgICAgICAn5Y2DJyxcbiAgICAgICAgICAgICfkuIcnLFxuICAgICAgICAgICAgJ+WNgScsXG4gICAgICAgICAgICAn55m+JyxcbiAgICAgICAgICAgICfljYMnLFxuICAgICAgICAgICAgJ+S6vycsXG4gICAgICAgICAgICAn5Y2BJyxcbiAgICAgICAgICAgICfnmb4nLFxuICAgICAgICAgICAgJ+WNgycsXG4gICAgICAgICAgICAn5LiH5Lq/JyxcbiAgICAgICAgICAgICfljYEnLFxuICAgICAgICAgICAgJ+eZvicsXG4gICAgICAgICAgICAn5Y2DJyxcbiAgICAgICAgICAgICflhYYnLFxuICAgICAgICAgICAgJ+WNgScsXG4gICAgICAgICAgICAn55m+JyxcbiAgICAgICAgICAgICfljYMnXG4gICAgICAgICAgXSxcbiAgICAgIGRlYzogWyfop5InLCAn5YiGJywgJ+WOmCcsICfmr6snXVxuICAgIH07XG4gICAgaWYgKGluV29yZHMpIHtcbiAgICAgIHZhbHVlID0gKCt2YWx1ZSkudG9GaXhlZCg1KS50b1N0cmluZygpO1xuICAgIH1cbiAgICBsZXQgaW50ZWdlclJlcyA9ICcnO1xuICAgIGNvbnN0IGludGVnZXJDb3VudCA9IGludGVnZXIubGVuZ3RoO1xuICAgIGlmIChpbnRlZ2VyID09PSAnMCcgfHwgaW50ZWdlckNvdW50ID09PSAwKSB7XG4gICAgICBpbnRlZ2VyUmVzID0gJ+mbtic7XG4gICAgfSBlbHNlIHtcbiAgICAgIGxldCBjbkRlc2MgPSAnJztcbiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgaW50ZWdlckNvdW50OyBpKyspIHtcbiAgICAgICAgY29uc3QgbiA9ICtpbnRlZ2VyW2ldO1xuICAgICAgICBjb25zdCBqID0gaW50ZWdlckNvdW50IC0gaSAtIDE7XG4gICAgICAgIGNvbnN0IGlzWmVybyA9IGkgPiAxICYmIG4gIT09IDAgJiYgaW50ZWdlcltpIC0gMV0gPT09ICcwJztcbiAgICAgICAgY29uc3QgY25aZXJvID0gaXNaZXJvID8gJ+mbticgOiAnJztcbiAgICAgICAgY29uc3QgaXNFbXBwdHlVbml0ID0gKG4gPT09IDAgJiYgaiAlIDQgIT09IDApIHx8IGludGVnZXIuc3Vic3RyaW5nKGkgLSAzLCBpIC0gMyArIDQpID09PSAnMDAwMCc7XG4gICAgICAgIGNvbnN0IGRlc2NNYXJrID0gY25EZXNjO1xuICAgICAgICBsZXQgY25OdW0gPSB1bml0Lm51bVtuXTtcblxuICAgICAgICBjbkRlc2MgPSBpc0VtcHB0eVVuaXQgPyAnJyA6IHVuaXQucmFkaW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GVjaW1hbFtpXTtcbiAgICAgICAgY29uc3QgY25aZXJvID0gbiA9PT0gJzAnID8gJ+mbticgOiAnJztcbiAgICAgICAgY29uc3QgY25OdW0gPSB1bml0Lm51bVsrbl07XG4gICAgICAgIGNvbnN0IGNuRGVzYyA9IGluV29yZHMgPyB1bml0LmRlY1tpXSA6ICcnO1xuICAgICAgICBkZWNpbWFsUmVzICs9IGNuWmVybyArIGNuTnVtICsgY25EZXNjO1xuICAgICAgfVxuICAgIH1cbiAgICBjb25zdCByZXQgPVxuICAgICAgc3ltYm9sICtcbiAgICAgIChpbldvcmRzXG4gICAgICAgID8gaW50ZWdlclJlcyArIChkZWNpbWFsUmVzID09PSAn6Zu2JyA/ICflhYPmlbQnIDogYOWFgyR7ZGVjaW1hbFJlc31gKVxuICAgICAgICA6IGludGVnZXJSZXMgKyAoZGVjaW1hbFJlcyA9PT0gJycgPyAnJyA6IGDngrkke2RlY2ltYWxSZXN9YCkpO1xuICAgIHJldHVybiByZXQ7XG4gIH1cbn1cbiJdfQ==
|
@@ -1,8 +1,8 @@
|
|
1
|
-
export const CurrencyMega_Powers = [
|
2
|
-
{ unit: 'Q', value: Math.pow(10, 15) },
|
3
|
-
{ unit: 'T', value: Math.pow(10, 12) },
|
4
|
-
{ unit: 'B', value: Math.pow(10, 9) },
|
5
|
-
{ unit: 'M', value: Math.pow(10, 6) },
|
6
|
-
{ unit: 'K', value: 1000 }
|
7
|
-
];
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
1
|
+
export const CurrencyMega_Powers = [
|
2
|
+
{ unit: 'Q', value: Math.pow(10, 15) },
|
3
|
+
{ unit: 'T', value: Math.pow(10, 12) },
|
4
|
+
{ unit: 'B', value: Math.pow(10, 9) },
|
5
|
+
{ unit: 'M', value: Math.pow(10, 6) },
|
6
|
+
{ unit: 'K', value: 1000 }
|
7
|
+
];
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVuY3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bml0OiAnVCcsIHZhbHVlOiBNYXRoLnBvdygxMCwgMTIpIH0sXG4gIHsgdW5pdDogJ0InLCB2YWx1ZTogTWF0aC5wb3coMTAsIDkpIH0sXG4gIHsgdW5pdDogJ00nLCB2YWx1ZTogTWF0aC5wb3coMTAsIDYpIH0sXG4gIHsgdW5pdDogJ0snLCB2YWx1ZTogMTAwMCB9XG5dO1xuXG5leHBvcnQgaW50ZXJmYWNlIEN1cnJlbmN5TWVnYVVuaXRJMThuIHtcbiAgUTogc3RyaW5nO1xuICBUOiBzdHJpbmc7XG4gIEI6IHN0cmluZztcbiAgTTogc3RyaW5nO1xuICBLOiBzdHJpbmc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQ3VycmVuY3lDTllPcHRpb25zIGV4dGVuZHMgQ3VycmVuY3lTdGFydGluZ1VuaXRPcHRpb25zIHtcbiAgLyoqXG4gICAqIFdoZXRoZXIgdG8gcmV0dXJuIHRvIHVwcGVyY2FzZSBub3RhdGlvbiwgZGVmYXVsdDogYHRydWVgXG4gICAqXG4gICAqIOaYr+WQpui/lOWbnuWkp+WGmeihqOekuuazle+8jOm7mOiupO+8mmB0cnVlYFxuICAgKi9cbiAgaW5Xb3Jkcz86IGJvb2xlYW47XG4gIC8qKlxuICAgKiBTcGVjaWZ5IG5lZ2F0aXZlIHNpZ24sIGRlZmF1bHQ6IGBuZWdhdGl2ZWBcbiAgICpcbiAgICog5oyH5a6a6LSf5pWw56ym5Y+377yM6buY6K6k77yaYOi0n2BcbiAgICovXG4gIG1pbnVzU3ltYm9sPzogc3RyaW5nO1xufVxuIl19
|
@@ -1,5 +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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9mb3JtYXQvZm9ybWF0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|
package/esm2022/format/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export * from './string';
|
2
|
-
export * from './validate';
|
3
|
-
export * from './currency.service';
|
4
|
-
export * from './currency.types';
|
1
|
+
export * from './string';
|
2
|
+
export * from './validate';
|
3
|
+
export * from './currency.service';
|
4
|
+
export * from './currency.types';
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Zvcm1hdC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFVBQVUsQ0FBQztBQUN6QixjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsa0JBQWtCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3N0cmluZyc7XG5leHBvcnQgKiBmcm9tICcuL3ZhbGlkYXRlJztcbmV4cG9ydCAqIGZyb20gJy4vY3VycmVuY3kuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2N1cnJlbmN5LnR5cGVzJztcbiJdfQ==
|