lyb-js 1.1.0 → 1.1.2
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/README.md +47 -4
- package/dist/Base/LibJsGetDataType/index.d.ts +1 -0
- package/dist/Base/LibJsGetDataType/index.js +1 -0
- package/dist/Base/LibJsPromiseTimeout/index.d.ts +1 -0
- package/dist/Base/LibJsPromiseTimeout/index.js +1 -0
- package/dist/Browser/LibJsColorConsole/index.d.ts +1 -0
- package/dist/Browser/LibJsColorConsole/index.js +1 -0
- package/dist/Browser/LibJsIsMobile/index.d.ts +1 -0
- package/dist/Browser/LibJsIsMobile/index.js +1 -0
- package/dist/Browser/LibJsIsPad/index.d.ts +1 -0
- package/dist/Browser/LibJsIsPad/index.js +1 -0
- package/dist/Browser/LibJsObjToUrlParams/index.d.ts +8 -0
- package/dist/Browser/LibJsObjToUrlParams/index.js +12 -0
- package/dist/Browser/LibJsPathParams/index.d.ts +1 -0
- package/dist/Browser/LibJsPathParams/index.js +1 -0
- package/dist/Browser/LibJsSetTitleIcon/index.d.ts +1 -0
- package/dist/Browser/LibJsSetTitleIcon/index.js +1 -0
- package/dist/Browser/LibJsTagTitleTip/index.d.ts +1 -0
- package/dist/Browser/LibJsTagTitleTip/index.js +1 -0
- package/dist/Data/LibJsChunkArray/index.d.ts +1 -0
- package/dist/Data/LibJsChunkArray/index.js +1 -0
- package/dist/Data/LibJsDeepJSONParse/index.d.ts +1 -0
- package/dist/Data/LibJsDeepJSONParse/index.js +1 -0
- package/dist/Data/LibJsGroupArrayByKey/index.d.ts +1 -0
- package/dist/Data/LibJsGroupArrayByKey/index.js +1 -0
- package/dist/Data/LibJsMatchEmail/index.d.ts +1 -0
- package/dist/Data/LibJsMatchEmail/index.js +1 -0
- package/dist/Data/LibJsShuffleArray/index.d.ts +1 -0
- package/dist/Data/LibJsShuffleArray/index.js +1 -0
- package/dist/Data/LibJsStepArray/index.d.ts +2 -1
- package/dist/Data/LibJsStepArray/index.js +2 -1
- package/dist/Data/LibReverseArrayFromIndex/index.d.ts +9 -0
- package/dist/Data/LibReverseArrayFromIndex/index.js +15 -0
- package/dist/File/LibJsDownloadImageLink/index.d.ts +1 -0
- package/dist/File/LibJsDownloadImageLink/index.js +1 -0
- package/dist/File/LibJsImageOptimizer/index.d.ts +1 -0
- package/dist/File/LibJsImageOptimizer/index.js +1 -0
- package/dist/File/LibJsSaveJson/index.d.ts +5 -4
- package/dist/File/LibJsSaveJson/index.js +5 -4
- package/dist/Formatter/LibJsFormatterByte/index.d.ts +1 -0
- package/dist/Formatter/LibJsFormatterByte/index.js +1 -0
- package/dist/Formatter/LibJsMaskPhoneNumber/index.d.ts +2 -1
- package/dist/Formatter/LibJsMaskPhoneNumber/index.js +2 -1
- package/dist/Formatter/LibJsNumComma/index.d.ts +1 -0
- package/dist/Formatter/LibJsNumComma/index.js +1 -0
- package/dist/Formatter/LibJsNumberUnit/index.d.ts +1 -0
- package/dist/Formatter/LibJsNumberUnit/index.js +1 -0
- package/dist/Formatter/LibJsSecondsFormatterChinese/index.d.ts +1 -0
- package/dist/Formatter/LibJsSecondsFormatterChinese/index.js +1 -0
- package/dist/Math/LibJsCalculateExpression/index.d.ts +1 -0
- package/dist/Math/LibJsCalculateExpression/index.js +1 -0
- package/dist/Math/LibJsConvertAngle/index.d.ts +1 -0
- package/dist/Math/LibJsConvertAngle/index.js +1 -0
- package/dist/Math/LibJsCoordsAngle/index.d.ts +1 -0
- package/dist/Math/LibJsCoordsAngle/index.js +1 -0
- package/dist/Math/LibJsCoordsDistance/index.d.ts +1 -0
- package/dist/Math/LibJsCoordsDistance/index.js +1 -0
- package/dist/Math/LibJsDecimal/index.d.ts +1 -0
- package/dist/Math/LibJsDecimal/index.js +1 -0
- package/dist/Misc/LibJsRegFormValidate/index.d.ts +1 -0
- package/dist/Misc/LibJsRegFormValidate/index.js +1 -0
- package/dist/Misc/LibJsRetryRequest/index.d.ts +1 -0
- package/dist/Misc/LibJsRetryRequest/index.js +1 -0
- package/dist/Misc/LibNumerStepper/index.d.ts +35 -0
- package/dist/Misc/LibNumerStepper/index.js +70 -0
- package/dist/Random/LibJsProbabilityResult/index.d.ts +1 -0
- package/dist/Random/LibJsProbabilityResult/index.js +1 -0
- package/dist/Random/LibJsRandom/index.d.ts +2 -1
- package/dist/Random/LibJsRandom/index.js +2 -1
- package/dist/Random/LibJsRandomColor/index.d.ts +1 -0
- package/dist/Random/LibJsRandomColor/index.js +1 -0
- package/dist/Random/LibJsUniqueRandomNumbers/index.d.ts +1 -0
- package/dist/Random/LibJsUniqueRandomNumbers/index.js +1 -0
- package/dist/Time/LibJsSameTimeCheck/index.d.ts +1 -0
- package/dist/Time/LibJsSameTimeCheck/index.js +1 -0
- package/dist/Time/LibJsTimeAgo/index.d.ts +1 -0
- package/dist/Time/LibJsTimeAgo/index.js +1 -0
- package/dist/Time/LibJsTimeGreeting/index.d.ts +1 -0
- package/dist/Time/LibJsTimeGreeting/index.js +1 -0
- package/dist/libJs.d.ts +65 -3
- package/dist/libJs.js +66 -2
- package/package.json +8 -5
- package/umd/lib.js +8 -0
package/dist/libJs.js
CHANGED
|
@@ -6,12 +6,14 @@ import { libJsIsPad } from "./Browser/LibJsIsPad";
|
|
|
6
6
|
import { libJsPathParams } from "./Browser/LibJsPathParams";
|
|
7
7
|
import { libJsSetTitleIcon } from "./Browser/LibJsSetTitleIcon";
|
|
8
8
|
import { libJsTagTitleTip } from "./Browser/LibJsTagTitleTip";
|
|
9
|
+
import { libJsObjToUrlParams } from "./Browser/LibJsObjToUrlParams";
|
|
9
10
|
import { libJsChunkArray } from "./Data/LibJsChunkArray";
|
|
10
11
|
import { libJsDeepJSONParse } from "./Data/LibJsDeepJSONParse";
|
|
11
12
|
import { libJsGroupArrayByKey } from "./Data/LibJsGroupArrayByKey";
|
|
12
13
|
import { libJsMatchEmail } from "./Data/LibJsMatchEmail";
|
|
13
14
|
import { libJsShuffleArray } from "./Data/LibJsShuffleArray";
|
|
14
15
|
import { libJsStepArray } from "./Data/LibJsStepArray";
|
|
16
|
+
import { libReverseArrayFromIndex } from "./Data/LibReverseArrayFromIndex";
|
|
15
17
|
import { libJsDownloadImageLink } from "./File/LibJsDownloadImageLink";
|
|
16
18
|
import { libJsImageOptimizer } from "./File/LibJsImageOptimizer";
|
|
17
19
|
import { libJsSaveJson } from "./File/LibJsSaveJson";
|
|
@@ -34,11 +36,13 @@ import { libJsUniqueRandomNumbers } from "./Random/LibJsUniqueRandomNumbers";
|
|
|
34
36
|
import { libJsSameTimeCheck } from "./Time/LibJsSameTimeCheck";
|
|
35
37
|
import { libJsTimeAgo } from "./Time/LibJsTimeAgo";
|
|
36
38
|
import { libJsTimeGreeting } from "./Time/LibJsTimeGreeting";
|
|
39
|
+
import { libNumerStepper } from "./Misc/LibNumerStepper";
|
|
37
40
|
/** @description 基础方法 */
|
|
38
41
|
export const Base = {
|
|
39
42
|
/**
|
|
40
43
|
* @description 返回数据类型
|
|
41
44
|
* @param v 需要判断类型的数据
|
|
45
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
42
46
|
* @example
|
|
43
47
|
* libJsGetDataType(123); //"number"
|
|
44
48
|
* libJsGetDataType("hello"); //"string"
|
|
@@ -49,6 +53,7 @@ export const Base = {
|
|
|
49
53
|
* @description 延时执行,切换到其他页面会暂停
|
|
50
54
|
* @param delay 延时毫秒数
|
|
51
55
|
* @param fn 延时执行函数
|
|
56
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
52
57
|
* @example
|
|
53
58
|
* libJsPromiseTimeout(3000, () => {
|
|
54
59
|
* console.log("执行延时函数");
|
|
@@ -62,6 +67,7 @@ export const Browser = {
|
|
|
62
67
|
* @param title 标题
|
|
63
68
|
* @param color 颜色
|
|
64
69
|
* @param logs 信息
|
|
70
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
65
71
|
* @example
|
|
66
72
|
* //使用红色打印日志
|
|
67
73
|
* libJsColorConsole("错误提示", "red", [{ label: "错误代码", value: 500 }]);
|
|
@@ -71,18 +77,21 @@ export const Browser = {
|
|
|
71
77
|
*/
|
|
72
78
|
libJsColorConsole,
|
|
73
79
|
/** @description 判断是否为移动设备
|
|
80
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
74
81
|
* @example
|
|
75
82
|
* const isMobile = libJsIsMobile();
|
|
76
83
|
* console.log(isMobile); //true 或 false
|
|
77
84
|
*/
|
|
78
85
|
libJsIsMobile,
|
|
79
86
|
/** @description 判断是否为平板
|
|
87
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
80
88
|
* @example
|
|
81
89
|
* const isPad = libJsIsPad();
|
|
82
90
|
* console.log(isPad); //true 或 false
|
|
83
91
|
*/
|
|
84
92
|
libJsIsPad,
|
|
85
93
|
/** @description 获取浏览器地址栏参数
|
|
94
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
86
95
|
* @example
|
|
87
96
|
* const params = libJsPathParams();
|
|
88
97
|
* console.log(params); //{ param1: "value1", param2: "value2" }
|
|
@@ -91,6 +100,7 @@ export const Browser = {
|
|
|
91
100
|
/** @description 动态设置网站标题及图标
|
|
92
101
|
* @param title 网站标题
|
|
93
102
|
* @param url 网站图标地址
|
|
103
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
94
104
|
* @example
|
|
95
105
|
* libJsSetTitleIcon("我的网站", "https://example.com/favicon.ico");
|
|
96
106
|
*/
|
|
@@ -98,10 +108,19 @@ export const Browser = {
|
|
|
98
108
|
/** @description 网站标题交互,当从当前网页切换到其他网页,网站标题自动切换
|
|
99
109
|
* @param backTitle 从其他网页返回时显示的标题
|
|
100
110
|
* @param leaveTitle 从当前网页离开时显示的标题
|
|
101
|
-
* * @
|
|
111
|
+
* * @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
112
|
+
* @example
|
|
102
113
|
* libJsTagTitleTip("欢迎回来", "来和妲己玩耍吧!");
|
|
103
114
|
*/
|
|
104
115
|
libJsTagTitleTip,
|
|
116
|
+
/** @description 对象转为url参数
|
|
117
|
+
* @param params 对象参数
|
|
118
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
119
|
+
* @example
|
|
120
|
+
* libJsObjToUrlParams({ name: "John", age: 30, active: true });
|
|
121
|
+
* // "name=John&age=30&active=true"
|
|
122
|
+
*/
|
|
123
|
+
libJsObjToUrlParams,
|
|
105
124
|
};
|
|
106
125
|
/** @description 数据相关方法 */
|
|
107
126
|
export const Data = {
|
|
@@ -109,12 +128,14 @@ export const Data = {
|
|
|
109
128
|
* @description 将数组拆分成指定数组元素数量的多个数组
|
|
110
129
|
* @param arr 需要拆分的数组
|
|
111
130
|
* @param chunkSize 每个数组的元素数量
|
|
131
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
112
132
|
* @example
|
|
113
133
|
* const chunks = libJsChunkArray([1, 2, 3, 4, 5, 6], 2);
|
|
114
134
|
* console.log(chunks); //[[1, 2], [3, 4], [5, 6]]
|
|
115
135
|
*/
|
|
116
136
|
libJsChunkArray,
|
|
117
137
|
/** @description 递归将JSON字符串深度解析为对象
|
|
138
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
118
139
|
* @example
|
|
119
140
|
* const obj = libJsDeepJSONParse('{"a": 1, "b": "{\"c\": 2}"}');
|
|
120
141
|
* console.log(obj); //{ a: 1, b: { c: 2 } }
|
|
@@ -125,6 +146,7 @@ export const Data = {
|
|
|
125
146
|
* @param arr 要分组的数组
|
|
126
147
|
* @param key 分组的键
|
|
127
148
|
* @returns 分组后的对象
|
|
149
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
128
150
|
* @example
|
|
129
151
|
* const grouped = libJsGroupArrayByKey([{ id: 1, name: 'A' }, { id: 2, name: 'B' }, { id: 1, name: 'C' }], 'id');
|
|
130
152
|
* console.log(grouped); //{ 1: [{ id: 1, name: 'A' }, { id: 1, name: 'C' }], 2: [{ id: 2, name: 'B' }] }
|
|
@@ -135,6 +157,7 @@ export const Data = {
|
|
|
135
157
|
* @param str 要匹配的字符串
|
|
136
158
|
* @param emailList 电子邮件后缀列表
|
|
137
159
|
* @returns 匹配结果数组
|
|
160
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
138
161
|
* @example
|
|
139
162
|
* const emails = libJsMatchEmail("user", ["@gmail.com", "@yahoo.com"]);
|
|
140
163
|
* console.log(emails); //["user@gmail.com", "user@yahoo.com"]
|
|
@@ -142,6 +165,7 @@ export const Data = {
|
|
|
142
165
|
libJsMatchEmail,
|
|
143
166
|
/** @description 数组乱序
|
|
144
167
|
* @param arr 需要乱序的数组
|
|
168
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
145
169
|
* @example
|
|
146
170
|
* const shuffled = libJsShuffleArray([1, 2, 3, 4, 5]);
|
|
147
171
|
* console.log(shuffled); //[3, 5, 2, 1, 4] (结果每次不同)
|
|
@@ -150,23 +174,35 @@ export const Data = {
|
|
|
150
174
|
/** @description 数组元素整体步数移动
|
|
151
175
|
* @param arr 移动的数组
|
|
152
176
|
* @param step 负数为向后移动,正数为向前移动
|
|
177
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
153
178
|
* @example
|
|
154
179
|
* const moved = libJsStepArray([1, 2, 3, 4, 5], 2);
|
|
155
180
|
* console.log(moved); //[4, 5, 1, 2, 3]
|
|
156
181
|
*/
|
|
157
182
|
libJsStepArray,
|
|
183
|
+
/** @description 翻转指定索引后面的数组
|
|
184
|
+
* @param arr 数组
|
|
185
|
+
* @param index 开始索引
|
|
186
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
187
|
+
* @example
|
|
188
|
+
* libReverseArrayFromIndex([1, 2, 3, 4, 5], 1);
|
|
189
|
+
* // [1, 2, 5, 4, 3]
|
|
190
|
+
*/
|
|
191
|
+
libReverseArrayFromIndex,
|
|
158
192
|
};
|
|
159
193
|
/** @description 文件相关方法 */
|
|
160
194
|
export const File = {
|
|
161
195
|
/** @description 下载图片链接
|
|
162
196
|
* @param link 图片链接
|
|
163
197
|
* @param name 图片名称
|
|
198
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
164
199
|
* @example
|
|
165
200
|
* libJsDownloadImageLink("https://example.com/image.jpg", "downloaded-image.jpg");
|
|
166
201
|
*/
|
|
167
202
|
libJsDownloadImageLink,
|
|
168
203
|
/** @description 图片压缩
|
|
169
204
|
* @param obj 压缩参数
|
|
205
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
170
206
|
* @example
|
|
171
207
|
* //图片压缩使用示例
|
|
172
208
|
* libJsImageOptimizerOptionsParams({
|
|
@@ -187,8 +223,9 @@ export const File = {
|
|
|
187
223
|
* @description 保存文件到本地
|
|
188
224
|
* @param data 要保存的数据
|
|
189
225
|
* @param name 文件名
|
|
226
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
190
227
|
* @example
|
|
191
|
-
* libJsSaveJson(JSON.stringify({ key: "value" })
|
|
228
|
+
* libJsSaveJson("example.json", JSON.stringify({ key: "value" }));
|
|
192
229
|
*/
|
|
193
230
|
libJsSaveJson,
|
|
194
231
|
};
|
|
@@ -198,6 +235,7 @@ export const Formatter = {
|
|
|
198
235
|
* @description 格式化字节大小
|
|
199
236
|
* @param bytes 字节数
|
|
200
237
|
* @returns ['大小', '单位', '大小及单位']
|
|
238
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
201
239
|
* @example
|
|
202
240
|
* const [size, unit, formatted] = libJsFormatterByte(2048);
|
|
203
241
|
* console.log(size, unit, formatted); //2.00 KB 2.00 KB
|
|
@@ -206,6 +244,7 @@ export const Formatter = {
|
|
|
206
244
|
/**
|
|
207
245
|
* @description 隐藏手机号码中间的四位数字
|
|
208
246
|
* @param mobile 需要处理的手机号码
|
|
247
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
209
248
|
* @example
|
|
210
249
|
* const masked = libJsMaskPhoneNumber("13812345678");
|
|
211
250
|
* console.log(masked); //138****5678
|
|
@@ -215,6 +254,7 @@ export const Formatter = {
|
|
|
215
254
|
* @description 数字每三位添加逗号
|
|
216
255
|
* @param num 需要格式化的数字
|
|
217
256
|
* @param reserve 保留小数位数
|
|
257
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
218
258
|
* @example
|
|
219
259
|
* const formatted = libJsNumComma(1234567.89);
|
|
220
260
|
* console.log(formatted); //1,234,567.89
|
|
@@ -224,6 +264,7 @@ export const Formatter = {
|
|
|
224
264
|
* @param num 数字
|
|
225
265
|
* @param units 单位组,key为单位,value为格式化阈值
|
|
226
266
|
* @returns [数字, 单位]
|
|
267
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
227
268
|
* @example
|
|
228
269
|
* const [value, unit] = libJsNumberUnit(1500, { K: 1000, M: 1000000 });
|
|
229
270
|
* console.log(value, unit); //1.50 K
|
|
@@ -233,6 +274,7 @@ export const Formatter = {
|
|
|
233
274
|
* @description 将秒数格式化为中文时间描述,支持扩展到年和月
|
|
234
275
|
* @param seconds 秒数
|
|
235
276
|
* @returns 格式化后的中文时间
|
|
277
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
236
278
|
* @example
|
|
237
279
|
* libJsSecondsFormatterChinese(100000); //"1天3小时46分40秒"
|
|
238
280
|
* libJsSecondsFormatterChinese(31536000); //"1年"
|
|
@@ -248,6 +290,7 @@ export const Math = {
|
|
|
248
290
|
* @param point 小数点精度
|
|
249
291
|
* @returns 计算结果
|
|
250
292
|
*
|
|
293
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
251
294
|
* @example
|
|
252
295
|
* const result = libJsCalculateExpression("(1+2)-(3*4)/5");
|
|
253
296
|
* console.log(result); //0.6
|
|
@@ -257,6 +300,7 @@ export const Math = {
|
|
|
257
300
|
* @description 角度和弧度互相转换
|
|
258
301
|
* @param value 角度值或弧度值
|
|
259
302
|
* @param type 角度类型或弧度类型
|
|
303
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
260
304
|
* @example
|
|
261
305
|
* //角度转弧度
|
|
262
306
|
* libJsConvertAngle(90, "rad"); //返回 1.5708... (π/2)
|
|
@@ -268,6 +312,7 @@ export const Math = {
|
|
|
268
312
|
/** @description 计算两点角度
|
|
269
313
|
* @param coord1 起点坐标
|
|
270
314
|
* @param coord2 终点坐标
|
|
315
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
271
316
|
* @example
|
|
272
317
|
* libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 0 }); //0
|
|
273
318
|
* libJsCoordsAngle({ x: 0, y: 0 }, { x: 1, y: 1 }); //45
|
|
@@ -277,6 +322,7 @@ export const Math = {
|
|
|
277
322
|
/** @description 计算两点距离
|
|
278
323
|
* @param coord1 起点坐标
|
|
279
324
|
* @param coord2 终点坐标
|
|
325
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
280
326
|
* @example
|
|
281
327
|
* libJsCoordsDistance({ x: 0, y: 0 }, { x: 3, y: 4 }); //5
|
|
282
328
|
* libJsCoordsDistance({ x: 1, y: 1 }, { x: 4, y: 5 }); //5
|
|
@@ -287,6 +333,7 @@ export const Math = {
|
|
|
287
333
|
* @param num1 第一个数
|
|
288
334
|
* @param num2 第二个数
|
|
289
335
|
* @param operator 运算符,支持加减乘除
|
|
336
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
290
337
|
* @example
|
|
291
338
|
* libJsDecimal(10, 3, "+"); //13
|
|
292
339
|
* libJsDecimal(10, 3, "-"); //7
|
|
@@ -301,6 +348,7 @@ export const Misc = {
|
|
|
301
348
|
* @param form 表单数据对象
|
|
302
349
|
* @param rules 验证规则数组
|
|
303
350
|
* @returns 验证结果数组,包含未通过验证的项
|
|
351
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
304
352
|
* @example
|
|
305
353
|
* const form = { username: "john", email: "john@example.com" };
|
|
306
354
|
* const rules = [
|
|
@@ -323,6 +371,7 @@ export const Misc = {
|
|
|
323
371
|
* @param maxRetries 最大重试次数
|
|
324
372
|
* @param retryDelay 重试间隔时间
|
|
325
373
|
* @param params 请求参数
|
|
374
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
326
375
|
* @example
|
|
327
376
|
* const requestFn = (params: { url: string }) => fetch(params.url).then(res => res.json());
|
|
328
377
|
* const params = { url: "https://api.example.com/data" };
|
|
@@ -336,11 +385,21 @@ export const Misc = {
|
|
|
336
385
|
* .catch(err => console.error(err));
|
|
337
386
|
*/
|
|
338
387
|
libJsRetryRequest,
|
|
388
|
+
/** @description 数字步进器
|
|
389
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
390
|
+
* @example
|
|
391
|
+
* const stepper = new libNumerStepper(10, (index) => console.log(index));
|
|
392
|
+
* stepper.down("add"); // 索引加1
|
|
393
|
+
* stepper.updateIndex(5); // 更新索引为5
|
|
394
|
+
* stepper.down("sub"); // 索引减1
|
|
395
|
+
*/
|
|
396
|
+
libNumerStepper,
|
|
339
397
|
};
|
|
340
398
|
/** @description 随机相关方法 */
|
|
341
399
|
export const Random = {
|
|
342
400
|
/** @description 百分比概率结果
|
|
343
401
|
* @param probability 触发概率,百分比,0-100
|
|
402
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
344
403
|
* @example
|
|
345
404
|
* libJsProbabilityResult(50); //50% 概率为 true
|
|
346
405
|
* libJsProbabilityResult(80); //80% 概率为 true
|
|
@@ -351,6 +410,7 @@ export const Random = {
|
|
|
351
410
|
* @param min 最小值
|
|
352
411
|
* @param max 最大值
|
|
353
412
|
* @param num 保留小数位数
|
|
413
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
354
414
|
* @example
|
|
355
415
|
* libJsRandom(1, 10); //1 到 10 之间的随机整数
|
|
356
416
|
* libJsRandom(1, 10, 2); //1 到 10 之间保留两位小数的随机数
|
|
@@ -359,6 +419,7 @@ export const Random = {
|
|
|
359
419
|
libJsRandom,
|
|
360
420
|
/** @description 随机 RGBA 颜色
|
|
361
421
|
* @param alpha 透明度
|
|
422
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
362
423
|
* @example
|
|
363
424
|
* libJsRandomColor(); //生成随机的 RGBA 颜色,默认透明度 1
|
|
364
425
|
* libJsRandomColor(0.5); //生成随机的 RGBA 颜色,透明度为 0.5
|
|
@@ -368,6 +429,7 @@ export const Random = {
|
|
|
368
429
|
* @param min 最小值
|
|
369
430
|
* @param max 最大值
|
|
370
431
|
* @param count 数组长度
|
|
432
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
371
433
|
* @example
|
|
372
434
|
* libJsUniqueRandomNumbers(1, 10, 5); //从 1 到 10 中随机生成 5 个唯一数字
|
|
373
435
|
* libJsUniqueRandomNumbers(1, 100, 10); //从 1 到 100 中随机生成 10 个唯一数字
|
|
@@ -385,6 +447,7 @@ export const Time = {
|
|
|
385
447
|
libJsSameTimeCheck,
|
|
386
448
|
/** @description 时间差计算
|
|
387
449
|
* @param timestamp 毫秒时间戳
|
|
450
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
388
451
|
* @example
|
|
389
452
|
* libJsTimeAgotamp(Date.now() - 3600000); //"1 小时前"
|
|
390
453
|
* libJsTimeAgotamp(Date.now() - 86400000); //"1 天前"
|
|
@@ -395,6 +458,7 @@ export const Time = {
|
|
|
395
458
|
/**
|
|
396
459
|
* @description 根据当前时间返回问候语
|
|
397
460
|
* @param greet 自定义问候语对象
|
|
461
|
+
* @link 了解更多:https://www.npmjs.com/package/lyb-js
|
|
398
462
|
* @example
|
|
399
463
|
* libJsTimeGreeting(); //根据当前时间返回默认问候语
|
|
400
464
|
* libJsTimeGreeting({ morning: "早安" }); //自定义早上问候语
|
package/package.json
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lyb-js",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"author": "冷弋白",
|
|
5
5
|
"description": "lyb自用JS方法库",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc"
|
|
10
|
+
"build": "tsc & vite build"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
"./*": "./dist/*"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"README.md"
|
|
17
|
+
"README.md",
|
|
18
|
+
"package.json",
|
|
19
|
+
"umd"
|
|
18
20
|
],
|
|
19
21
|
"repository": {
|
|
20
22
|
"type": "git",
|
|
@@ -32,6 +34,7 @@
|
|
|
32
34
|
},
|
|
33
35
|
"dependencies": {
|
|
34
36
|
"dayjs": "^1.11.13",
|
|
35
|
-
"decimal.js": "^10.4.3"
|
|
37
|
+
"decimal.js": "^10.4.3",
|
|
38
|
+
"vite": "^4.5.5"
|
|
36
39
|
}
|
|
37
|
-
}
|
|
40
|
+
}
|
package/umd/lib.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(ee){typeof define=="function"&&define.amd?define(ee):ee()})(function(){"use strict";var An=Object.defineProperty;var Ln=(ee,ne,fe)=>ne in ee?An(ee,ne,{enumerable:!0,configurable:!0,writable:!0,value:fe}):ee[ne]=fe;var de=(ee,ne,fe)=>(Ln(ee,typeof ne!="symbol"?ne+"":ne,fe),fe);const ee=e=>Object.prototype.toString.call(e).substring(8).replace(/]/g,"").toLowerCase(),ne=(e=1,t)=>{let n,i=e,r=Date.now(),s=!1;return new Promise(o=>{const u=()=>{document.hidden?(s=!0,clearTimeout(n),i-=Date.now()-r):s&&(s=!1,r=Date.now(),a(o))},a=c=>{n=setTimeout(()=>{t==null||t(),c(),document.removeEventListener("visibilitychange",u)},i)};document.addEventListener("visibilitychange",u),a(o)})},fe=(e,t,n=[])=>{const i={red:"#c0392b",orange:"#d35400",yellow:"#f1c40f",green:"#27ae60",blue:"#2980b9",purple:"#be2edd"},r=()=>{const s=new Date,o=String(s.getHours()).padStart(2,"0"),u=String(s.getMinutes()).padStart(2,"0"),a=String(s.getSeconds()).padStart(2,"0");return`[${o}:${u}:${a}]`};if(Array.isArray(n)){const s=n.map(o=>[`
|
|
2
|
+
${o.label}:`,o.value]);console.log(`%c${r()}-${e}`,`color: #fff;background: ${i[t]}; font-size:14px;border-radius:5px;padding:0.25em;margin:0.5em 0`,...s.flat(1/0))}else console.log(`%c${r()}-${e}`,`color: #fff;background: ${i[t]}; font-size:14px;border-radius:5px;padding:0.25em;margin:0.5em 0`,n)},et=()=>{const e=navigator.userAgent.toLowerCase();return/mobile|android|iphone|ipod/.test(e)},tt=()=>{const e=navigator.userAgent.toLowerCase(),t=Math.max(window.screen.width,window.screen.height),n=Math.min(window.screen.width,window.screen.height),i=t/n,r=/ipad|tablet|playbook|silk/.test(e)&&!/mobile/.test(e),s=t>=768&&t<=1366,o=i>=1.3&&i<=1.6;return r||s&&o},nt=()=>{const t=location.href.split("?")[1];return t?t.split("&").reduce((i,r)=>{const[s,o]=r.split(/=(.+)/);return i[s]=o,i},{})||{}:{}},it=(e,t)=>{document.title=e;const n=document.createElement("link");n.setAttribute("rel","icon"),n.setAttribute("href",t),(document.head||document.getElementsByTagName("head")[0]).appendChild(n)},rt=(e,t)=>{let n="",i;window.addEventListener("visibilitychange",()=>{if(clearTimeout(i),document.hidden){document.title!==e&&(n=document.title),document.title=t;return}document.title=e,i=setTimeout(()=>{document.title=n},1e3)})},st=e=>Object.entries(e).map(([t,n])=>`${t}=${n}`).join("&"),ot=(e,t)=>{const n=[];for(let i=0;i<e.length;i+=t)n.push(e.slice(i,i+t));return n},Me=e=>{if(typeof e=="string")try{const t=JSON.parse(e);return Me(t)}catch{return e}return Array.isArray(e)?e.map(t=>Me(t)):e!==null&&typeof e=="object"?Object.keys(e).reduce((t,n)=>(t[n]=Me(e[n]),t),{}):e},ut=(e=[],t)=>t?e.reduce((n,i)=>(n[i[t]]||(n[i[t]]=[]),n[i[t]].push(i),n),{}):{},ct=(e,t)=>e.includes("@")?t.filter(n=>n.includes(e.slice(e.indexOf("@")))).map(n=>(e.includes("@")?e.split("@")[0]:e)+n):t.map(n=>e+n),at=e=>{const t=[...e];for(let n=t.length-1;n>0;n--){const i=Math.floor(Math.random()*(n+1));[t[n],t[i]]=[t[i],t[n]]}return t},ft=(e,t)=>{const n=e.length;if(n===0||t%n===0)return e;const i=(t%n+n)%n;return e.slice(-i).concat(e.slice(0,-i))},lt=(e,t)=>{if(t<0||t>=e.length)throw new Error("Index out of bounds");const n=e.slice(t+1).reverse();return[...e.slice(0,t+1),...n]},ht=(e,t)=>{fetch(e).then(n=>n.blob()).then(n=>{const i=document.createElement("a"),r=window.URL.createObjectURL(n);i.href=r,i.download=t,i.click()})},dt=e=>{const t=document.createElement("canvas");t.classList.add("imageOptimizer"),document.body.appendChild(t);const n=e.file;if(!n)return;const i=n.name,r=i.split(".").pop().toLowerCase(),s=e.ratio||1,o=e.maxSize||1024,u=e.width||1e4,a=n.type;function c(h,p){const w=h.split(","),M=w[0].match(/:(.*?);/)[1],F=window.atob(w[1]),A=F.length,H=new Uint8Array(A);for(let O=0;O<A;O++)H[O]=F.charCodeAt(O);return new File([H],p,{type:M})}function f(h){const p=new FormData;return p.append("file",h),p}const l=new FileReader;l.readAsDataURL(n),l.onload=h=>{const p=h.target.result;if(h.total/1024>o){const w=new Image;w.src=p,w.onload=()=>{const M=t.getContext("2d"),F=u/w.width;F<1?(t.width=w.width*F,t.height=w.height*F,M.drawImage(w,0,0,w.width*F,w.height*F)):(t.width=w.width,t.height=w.height,M.drawImage(w,0,0,w.width,w.height));const A=t.toDataURL(a,s),H=`${i.split(".")[0]}.${r}`,O=c(A,H);e.success(f(O),O,A),t.remove()},w.onerror=e.fail}else{const w=`${i.split(".")[0]}.${r}`,M=c(p,w);e.success(f(M),M,p),t.remove()}},l.onerror=e.fail},mt=(e,t)=>{const n=window.URL||window.webkitURL,i=new Blob([t]),r=document.createElement("a");r.href=n.createObjectURL(i),r.download=e,r.click(),n.revokeObjectURL(r.href)};var Pe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Je(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Pe,function(){var n=1e3,i=6e4,r=36e5,s="millisecond",o="second",u="minute",a="hour",c="day",f="week",l="month",h="quarter",p="year",w="date",M="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,A=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,H={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var g=["th","st","nd","rd"],m=N%100;return"["+N+(g[(m-20)%10]||g[m]||g[0])+"]"}},O=function(N,g,m){var D=String(N);return!D||D.length>=g?N:""+Array(g+1-D.length).join(m)+N},q={s:O,z:function(N){var g=-N.utcOffset(),m=Math.abs(g),D=Math.floor(m/60),$=m%60;return(g<=0?"+":"-")+O(D,2,"0")+":"+O($,2,"0")},m:function N(g,m){if(g.date()<m.date())return-N(m,g);var D=12*(m.year()-g.year())+(m.month()-g.month()),$=g.clone().add(D,l),C=m-$<0,I=g.clone().add(D+(C?-1:1),l);return+(-(D+(m-$)/(C?$-I:I-$))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:l,y:p,w:f,d:c,D:w,h:a,m:u,s:o,ms:s,Q:h}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},x="en",T={};T[x]=H;var E="$isDayjsObject",v=function(N){return N instanceof R||!(!N||!N[E])},L=function N(g,m,D){var $;if(!g)return x;if(typeof g=="string"){var C=g.toLowerCase();T[C]&&($=C),m&&(T[C]=m,$=C);var I=g.split("-");if(!$&&I.length>1)return N(I[0])}else{var J=g.name;T[J]=g,$=J}return!D&&$&&(x=$),$||!D&&x},y=function(N,g){if(v(N))return N.clone();var m=typeof g=="object"?g:{};return m.date=N,m.args=arguments,new R(m)},b=q;b.l=L,b.i=v,b.w=function(N,g){return y(N,{locale:g.$L,utc:g.$u,x:g.$x,$offset:g.$offset})};var R=function(){function N(m){this.$L=L(m.locale,null,!0),this.parse(m),this.$x=this.$x||m.x||{},this[E]=!0}var g=N.prototype;return g.parse=function(m){this.$d=function(D){var $=D.date,C=D.utc;if($===null)return new Date(NaN);if(b.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var I=$.match(F);if(I){var J=I[2]-1||0,B=(I[7]||"0").substring(0,3);return C?new Date(Date.UTC(I[1],J,I[3]||1,I[4]||0,I[5]||0,I[6]||0,B)):new Date(I[1],J,I[3]||1,I[4]||0,I[5]||0,I[6]||0,B)}}return new Date($)}(m),this.init()},g.init=function(){var m=this.$d;this.$y=m.getFullYear(),this.$M=m.getMonth(),this.$D=m.getDate(),this.$W=m.getDay(),this.$H=m.getHours(),this.$m=m.getMinutes(),this.$s=m.getSeconds(),this.$ms=m.getMilliseconds()},g.$utils=function(){return b},g.isValid=function(){return this.$d.toString()!==M},g.isSame=function(m,D){var $=y(m);return this.startOf(D)<=$&&$<=this.endOf(D)},g.isAfter=function(m,D){return y(m)<this.startOf(D)},g.isBefore=function(m,D){return this.endOf(D)<y(m)},g.$g=function(m,D,$){return b.u(m)?this[D]:this.set($,m)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(m,D){var $=this,C=!!b.u(D)||D,I=b.p(m),J=function(he,G){var ae=b.w($.$u?Date.UTC($.$y,G,he):new Date($.$y,G,he),$);return C?ae:ae.endOf(c)},B=function(he,G){return b.w($.toDate()[he].apply($.toDate("s"),(C?[0,0,0,0]:[23,59,59,999]).slice(G)),$)},Z=this.$W,V=this.$M,X=this.$D,ge="set"+(this.$u?"UTC":"");switch(I){case p:return C?J(1,0):J(31,11);case l:return C?J(1,V):J(0,V+1);case f:var le=this.$locale().weekStart||0,ve=(Z<le?Z+7:Z)-le;return J(C?X-ve:X+(6-ve),V);case c:case w:return B(ge+"Hours",0);case a:return B(ge+"Minutes",1);case u:return B(ge+"Seconds",2);case o:return B(ge+"Milliseconds",3);default:return this.clone()}},g.endOf=function(m){return this.startOf(m,!1)},g.$set=function(m,D){var $,C=b.p(m),I="set"+(this.$u?"UTC":""),J=($={},$[c]=I+"Date",$[w]=I+"Date",$[l]=I+"Month",$[p]=I+"FullYear",$[a]=I+"Hours",$[u]=I+"Minutes",$[o]=I+"Seconds",$[s]=I+"Milliseconds",$)[C],B=C===c?this.$D+(D-this.$W):D;if(C===l||C===p){var Z=this.clone().set(w,1);Z.$d[J](B),Z.init(),this.$d=Z.set(w,Math.min(this.$D,Z.daysInMonth())).$d}else J&&this.$d[J](B);return this.init(),this},g.set=function(m,D){return this.clone().$set(m,D)},g.get=function(m){return this[b.p(m)]()},g.add=function(m,D){var $,C=this;m=Number(m);var I=b.p(D),J=function(V){var X=y(C);return b.w(X.date(X.date()+Math.round(V*m)),C)};if(I===l)return this.set(l,this.$M+m);if(I===p)return this.set(p,this.$y+m);if(I===c)return J(1);if(I===f)return J(7);var B=($={},$[u]=i,$[a]=r,$[o]=n,$)[I]||1,Z=this.$d.getTime()+m*B;return b.w(Z,this)},g.subtract=function(m,D){return this.add(-1*m,D)},g.format=function(m){var D=this,$=this.$locale();if(!this.isValid())return $.invalidDate||M;var C=m||"YYYY-MM-DDTHH:mm:ssZ",I=b.z(this),J=this.$H,B=this.$m,Z=this.$M,V=$.weekdays,X=$.months,ge=$.meridiem,le=function(G,ae,$e,Te){return G&&(G[ae]||G(D,C))||$e[ae].slice(0,Te)},ve=function(G){return b.s(J%12||12,G,"0")},he=ge||function(G,ae,$e){var Te=G<12?"AM":"PM";return $e?Te.toLowerCase():Te};return C.replace(A,function(G,ae){return ae||function($e){switch($e){case"YY":return String(D.$y).slice(-2);case"YYYY":return b.s(D.$y,4,"0");case"M":return Z+1;case"MM":return b.s(Z+1,2,"0");case"MMM":return le($.monthsShort,Z,X,3);case"MMMM":return le(X,Z);case"D":return D.$D;case"DD":return b.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return le($.weekdaysMin,D.$W,V,2);case"ddd":return le($.weekdaysShort,D.$W,V,3);case"dddd":return V[D.$W];case"H":return String(J);case"HH":return b.s(J,2,"0");case"h":return ve(1);case"hh":return ve(2);case"a":return he(J,B,!0);case"A":return he(J,B,!1);case"m":return String(B);case"mm":return b.s(B,2,"0");case"s":return String(D.$s);case"ss":return b.s(D.$s,2,"0");case"SSS":return b.s(D.$ms,3,"0");case"Z":return I}return null}(G)||I.replace(":","")})},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(m,D,$){var C,I=this,J=b.p(D),B=y(m),Z=(B.utcOffset()-this.utcOffset())*i,V=this-B,X=function(){return b.m(I,B)};switch(J){case p:C=X()/12;break;case l:C=X();break;case h:C=X()/3;break;case f:C=(V-Z)/6048e5;break;case c:C=(V-Z)/864e5;break;case a:C=V/r;break;case u:C=V/i;break;case o:C=V/n;break;default:C=V}return $?C:b.a(C)},g.daysInMonth=function(){return this.endOf(l).$D},g.$locale=function(){return T[this.$L]},g.locale=function(m,D){if(!m)return this.$L;var $=this.clone(),C=L(m,D,!0);return C&&($.$L=C),$},g.clone=function(){return b.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},N}(),U=R.prototype;return y.prototype=U,[["$ms",s],["$s",o],["$m",u],["$H",a],["$W",c],["$M",l],["$y",p],["$D",w]].forEach(function(N){U[N[1]]=function(g){return this.$g(g,N[0],N[1])}}),y.extend=function(N,g){return N.$i||(N(g,R,y),N.$i=!0),y},y.locale=L,y.isDayjs=v,y.unix=function(N){return y(1e3*N)},y.en=T[x],y.Ls=T,y.p={},y})})(Re);var pt=Re.exports;const be=Je(pt);var qe={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(Pe,function(){var n,i,r=1e3,s=6e4,o=36e5,u=864e5,a=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c=31536e6,f=2628e6,l=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:c,months:f,days:u,hours:o,minutes:s,seconds:r,milliseconds:1,weeks:6048e5},p=function(T){return T instanceof q},w=function(T,E,v){return new q(T,v,E.$l)},M=function(T){return i.p(T)+"s"},F=function(T){return T<0},A=function(T){return F(T)?Math.ceil(T):Math.floor(T)},H=function(T){return Math.abs(T)},O=function(T,E){return T?F(T)?{negative:!0,format:""+H(T)+E}:{negative:!1,format:""+T+E}:{negative:!1,format:""}},q=function(){function T(v,L,y){var b=this;if(this.$d={},this.$l=y,v===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return w(v*h[M(L)],this);if(typeof v=="number")return this.$ms=v,this.parseFromMilliseconds(),this;if(typeof v=="object")return Object.keys(v).forEach(function(N){b.$d[M(N)]=v[N]}),this.calMilliseconds(),this;if(typeof v=="string"){var R=v.match(l);if(R){var U=R.slice(2).map(function(N){return N!=null?Number(N):0});return this.$d.years=U[0],this.$d.months=U[1],this.$d.weeks=U[2],this.$d.days=U[3],this.$d.hours=U[4],this.$d.minutes=U[5],this.$d.seconds=U[6],this.calMilliseconds(),this}}return this}var E=T.prototype;return E.calMilliseconds=function(){var v=this;this.$ms=Object.keys(this.$d).reduce(function(L,y){return L+(v.$d[y]||0)*h[y]},0)},E.parseFromMilliseconds=function(){var v=this.$ms;this.$d.years=A(v/c),v%=c,this.$d.months=A(v/f),v%=f,this.$d.days=A(v/u),v%=u,this.$d.hours=A(v/o),v%=o,this.$d.minutes=A(v/s),v%=s,this.$d.seconds=A(v/r),v%=r,this.$d.milliseconds=v},E.toISOString=function(){var v=O(this.$d.years,"Y"),L=O(this.$d.months,"M"),y=+this.$d.days||0;this.$d.weeks&&(y+=7*this.$d.weeks);var b=O(y,"D"),R=O(this.$d.hours,"H"),U=O(this.$d.minutes,"M"),N=this.$d.seconds||0;this.$d.milliseconds&&(N+=this.$d.milliseconds/1e3,N=Math.round(1e3*N)/1e3);var g=O(N,"S"),m=v.negative||L.negative||b.negative||R.negative||U.negative||g.negative,D=R.format||U.format||g.format?"T":"",$=(m?"-":"")+"P"+v.format+L.format+b.format+D+R.format+U.format+g.format;return $==="P"||$==="-P"?"P0D":$},E.toJSON=function(){return this.toISOString()},E.format=function(v){var L=v||"YYYY-MM-DDTHH:mm:ss",y={Y:this.$d.years,YY:i.s(this.$d.years,2,"0"),YYYY:i.s(this.$d.years,4,"0"),M:this.$d.months,MM:i.s(this.$d.months,2,"0"),D:this.$d.days,DD:i.s(this.$d.days,2,"0"),H:this.$d.hours,HH:i.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:i.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:i.s(this.$d.seconds,2,"0"),SSS:i.s(this.$d.milliseconds,3,"0")};return L.replace(a,function(b,R){return R||String(y[b])})},E.as=function(v){return this.$ms/h[M(v)]},E.get=function(v){var L=this.$ms,y=M(v);return y==="milliseconds"?L%=1e3:L=y==="weeks"?A(L/h[y]):this.$d[y],L||0},E.add=function(v,L,y){var b;return b=L?v*h[M(L)]:p(v)?v.$ms:w(v,this).$ms,w(this.$ms+b*(y?-1:1),this)},E.subtract=function(v,L){return this.add(v,L,!0)},E.locale=function(v){var L=this.clone();return L.$l=v,L},E.clone=function(){return w(this.$ms,this)},E.humanize=function(v){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!v)},E.valueOf=function(){return this.asMilliseconds()},E.milliseconds=function(){return this.get("milliseconds")},E.asMilliseconds=function(){return this.as("milliseconds")},E.seconds=function(){return this.get("seconds")},E.asSeconds=function(){return this.as("seconds")},E.minutes=function(){return this.get("minutes")},E.asMinutes=function(){return this.as("minutes")},E.hours=function(){return this.get("hours")},E.asHours=function(){return this.as("hours")},E.days=function(){return this.get("days")},E.asDays=function(){return this.as("days")},E.weeks=function(){return this.get("weeks")},E.asWeeks=function(){return this.as("weeks")},E.months=function(){return this.get("months")},E.asMonths=function(){return this.as("months")},E.years=function(){return this.get("years")},E.asYears=function(){return this.as("years")},T}(),x=function(T,E,v){return T.add(E.years()*v,"y").add(E.months()*v,"M").add(E.days()*v,"d").add(E.hours()*v,"h").add(E.minutes()*v,"m").add(E.seconds()*v,"s").add(E.milliseconds()*v,"ms")};return function(T,E,v){n=v,i=v().$utils(),v.duration=function(b,R){var U=v.locale();return w(b,{$l:U},R)},v.isDuration=p;var L=E.prototype.add,y=E.prototype.subtract;E.prototype.add=function(b,R){return p(b)?x(this,b,1):L.bind(this)(b,R)},E.prototype.subtract=function(b,R){return p(b)?x(this,b,-1):y.bind(this)(b,R)}}})})(qe);var gt=qe.exports;const wt=Je(gt);be.extend(wt);const vt=e=>{const t=be.duration(e,"seconds"),n=Math.floor(t.asYears()),i=Math.floor(t.asMonths()%12),r=Math.floor(t.asDays()%30),s=t.hours(),o=t.minutes(),u=t.seconds(),a=[];return n>0&&a.push(`${n}年`),i>0&&a.push(`${i}月`),r>0&&a.push(`${r}天`),s>0&&a.push(`${s}小时`),o>0&&a.push(`${o}分`),(a.length===0||u>0)&&a.push(`${u}秒`),a.join("")},$t=e=>{if(e<=0)return[0,"B","0 B"];const t=1024,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1),r=(e/t**i).toFixed(2);return[r,n[i],`${r} ${n[i]}`]},Mt=e=>e.toString().replace(/^(\d{3})\d{4}(\d{4})$/,"$1****$2"),bt=(e,t=2)=>{const n=e.toFixed(t).toString(),i=n.indexOf(".")>-1?/(\d)(?=(\d{3})+\.)/g:/(\d)(?=(?:\d{3})+$)/g;return n.replace(i,"$1,")};/*!
|
|
3
|
+
* decimal.js v10.4.3
|
|
4
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
|
5
|
+
* https://github.com/MikeMcl/decimal.js
|
|
6
|
+
* Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
7
|
+
* MIT Licence
|
|
8
|
+
*/var me=9e15,se=1e9,ye="0123456789abcdef",Ne="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Se="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Ce={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-me,maxE:me,crypto:!1},Ue,ie,_=!0,De="[DecimalError] ",oe=De+"Invalid argument: ",Be=De+"Precision limit exceeded",He=De+"crypto unavailable",Ye="[object Decimal]",W=Math.floor,Y=Math.pow,Nt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,St=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Dt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ze=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,K=1e7,k=7,Et=9007199254740991,kt=Ne.length-1,Ie=Se.length-1,d={toStringTag:Ye};d.absoluteValue=d.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),S(e)},d.ceil=function(){return S(new this.constructor(this),this.e+1,2)},d.clampedTo=d.clamp=function(e,t){var n,i=this,r=i.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(oe+t);return n=i.cmp(e),n<0?e:i.cmp(t)>0?t:new r(i)},d.comparedTo=d.cmp=function(e){var t,n,i,r,s=this,o=s.d,u=(e=new s.constructor(e)).d,a=s.s,c=e.s;if(!o||!u)return!a||!c?NaN:a!==c?a:o===u?0:!o^a<0?1:-1;if(!o[0]||!u[0])return o[0]?a:u[0]?-c:0;if(a!==c)return a;if(s.e!==e.e)return s.e>e.e^a<0?1:-1;for(i=o.length,r=u.length,t=0,n=i<r?i:r;t<n;++t)if(o[t]!==u[t])return o[t]>u[t]^a<0?1:-1;return i===r?0:i>r^a<0?1:-1},d.cosine=d.cos=function(){var e,t,n=this,i=n.constructor;return n.d?n.d[0]?(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+k,i.rounding=1,n=_t(i,xe(i,n)),i.precision=e,i.rounding=t,S(ie==2||ie==3?n.neg():n,e,t,!0)):new i(1):new i(NaN)},d.cubeRoot=d.cbrt=function(){var e,t,n,i,r,s,o,u,a,c,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(_=!1,s=f.s*Y(f.s*f,1/3),!s||Math.abs(s)==1/0?(n=j(f.d),e=f.e,(s=(e-n.length+1)%3)&&(n+=s==1||s==-2?"0":"00"),s=Y(n,1/3),e=W((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?n="5e"+e:(n=s.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),i=new l(n),i.s=f.s):i=new l(s.toString()),o=(e=l.precision)+3;;)if(u=i,a=u.times(u).times(u),c=a.plus(f),i=P(c.plus(f).times(u),c.plus(a),o+2,1),j(u.d).slice(0,o)===(n=j(i.d)).slice(0,o))if(n=n.slice(o-3,o+1),n=="9999"||!r&&n=="4999"){if(!r&&(S(u,e+1,0),u.times(u).times(u).eq(f))){i=u;break}o+=4,r=1}else{(!+n||!+n.slice(1)&&n.charAt(0)=="5")&&(S(i,e+1,1),t=!i.times(i).times(i).eq(f));break}return _=!0,S(i,e,l.rounding,t)},d.decimalPlaces=d.dp=function(){var e,t=this.d,n=NaN;if(t){if(e=t.length-1,n=(e-W(this.e/k))*k,e=t[e],e)for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},d.dividedBy=d.div=function(e){return P(this,new this.constructor(e))},d.dividedToIntegerBy=d.divToInt=function(e){var t=this,n=t.constructor;return S(P(t,new n(e),0,1,1),n.precision,n.rounding)},d.equals=d.eq=function(e){return this.cmp(e)===0},d.floor=function(){return S(new this.constructor(this),this.e+1,3)},d.greaterThan=d.gt=function(e){return this.cmp(e)>0},d.greaterThanOrEqualTo=d.gte=function(e){var t=this.cmp(e);return t==1||t===0},d.hyperbolicCosine=d.cosh=function(){var e,t,n,i,r,s=this,o=s.constructor,u=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return u;n=o.precision,i=o.rounding,o.precision=n+Math.max(s.e,s.sd())+4,o.rounding=1,r=s.d.length,r<32?(e=Math.ceil(r/3),t=(1/Oe(4,e)).toString()):(e=16,t="2.3283064365386962890625e-10"),s=pe(o,1,s.times(t),new o(1),!0);for(var a,c=e,f=new o(8);c--;)a=s.times(s),s=u.minus(a.times(f.minus(a.times(f))));return S(s,o.precision=n,o.rounding=i,!0)},d.hyperbolicSine=d.sinh=function(){var e,t,n,i,r=this,s=r.constructor;if(!r.isFinite()||r.isZero())return new s(r);if(t=s.precision,n=s.rounding,s.precision=t+Math.max(r.e,r.sd())+4,s.rounding=1,i=r.d.length,i<3)r=pe(s,2,r,r,!0);else{e=1.4*Math.sqrt(i),e=e>16?16:e|0,r=r.times(1/Oe(5,e)),r=pe(s,2,r,r,!0);for(var o,u=new s(5),a=new s(16),c=new s(20);e--;)o=r.times(r),r=r.times(u.plus(o.times(a.times(o).plus(c))))}return s.precision=t,s.rounding=n,S(r,t,n,!0)},d.hyperbolicTangent=d.tanh=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+7,i.rounding=1,P(n.sinh(),n.cosh(),i.precision=e,i.rounding=t)):new i(n.s)},d.inverseCosine=d.acos=function(){var e,t=this,n=t.constructor,i=t.abs().cmp(1),r=n.precision,s=n.rounding;return i!==-1?i===0?t.isNeg()?Q(n,r,s):new n(0):new n(NaN):t.isZero()?Q(n,r+4,s).times(.5):(n.precision=r+6,n.rounding=1,t=t.asin(),e=Q(n,r+4,s).times(.5),n.precision=r,n.rounding=s,e.minus(t))},d.inverseHyperbolicCosine=d.acosh=function(){var e,t,n=this,i=n.constructor;return n.lte(1)?new i(n.eq(1)?0:NaN):n.isFinite()?(e=i.precision,t=i.rounding,i.precision=e+Math.max(Math.abs(n.e),n.sd())+4,i.rounding=1,_=!1,n=n.times(n).minus(1).sqrt().plus(n),_=!0,i.precision=e,i.rounding=t,n.ln()):new i(n)},d.inverseHyperbolicSine=d.asinh=function(){var e,t,n=this,i=n.constructor;return!n.isFinite()||n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,i.rounding=1,_=!1,n=n.times(n).plus(1).sqrt().plus(n),_=!0,i.precision=e,i.rounding=t,n.ln())},d.inverseHyperbolicTangent=d.atanh=function(){var e,t,n,i,r=this,s=r.constructor;return r.isFinite()?r.e>=0?new s(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(e=s.precision,t=s.rounding,i=r.sd(),Math.max(i,e)<2*-r.e-1?S(new s(r),e,t,!0):(s.precision=n=i-r.e,r=P(r.plus(1),new s(1).minus(r),n+e,1),s.precision=e+4,s.rounding=1,r=r.ln(),s.precision=e,s.rounding=t,r.times(.5))):new s(NaN)},d.inverseSine=d.asin=function(){var e,t,n,i,r=this,s=r.constructor;return r.isZero()?new s(r):(t=r.abs().cmp(1),n=s.precision,i=s.rounding,t!==-1?t===0?(e=Q(s,n+4,i).times(.5),e.s=r.s,e):new s(NaN):(s.precision=n+6,s.rounding=1,r=r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(),s.precision=n,s.rounding=i,r.times(2)))},d.inverseTangent=d.atan=function(){var e,t,n,i,r,s,o,u,a,c=this,f=c.constructor,l=f.precision,h=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&l+4<=Ie)return o=Q(f,l+4,h).times(.25),o.s=c.s,o}else{if(!c.s)return new f(NaN);if(l+4<=Ie)return o=Q(f,l+4,h).times(.5),o.s=c.s,o}for(f.precision=u=l+10,f.rounding=1,n=Math.min(28,u/k+2|0),e=n;e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(_=!1,t=Math.ceil(u/k),i=1,a=c.times(c),o=new f(c),r=c;e!==-1;)if(r=r.times(a),s=o.minus(r.div(i+=2)),r=r.times(a),o=s.plus(r.div(i+=2)),o.d[t]!==void 0)for(e=t;o.d[e]===s.d[e]&&e--;);return n&&(o=o.times(2<<n-1)),_=!0,S(o,f.precision=l,f.rounding=h,!0)},d.isFinite=function(){return!!this.d},d.isInteger=d.isInt=function(){return!!this.d&&W(this.e/k)>this.d.length-2},d.isNaN=function(){return!this.s},d.isNegative=d.isNeg=function(){return this.s<0},d.isPositive=d.isPos=function(){return this.s>0},d.isZero=function(){return!!this.d&&this.d[0]===0},d.lessThan=d.lt=function(e){return this.cmp(e)<0},d.lessThanOrEqualTo=d.lte=function(e){return this.cmp(e)<1},d.logarithm=d.log=function(e){var t,n,i,r,s,o,u,a,c=this,f=c.constructor,l=f.precision,h=f.rounding,p=5;if(e==null)e=new f(10),t=!0;else{if(e=new f(e),n=e.d,e.s<0||!n||!n[0]||e.eq(1))return new f(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new f(n&&!n[0]?-1/0:c.s!=1?NaN:n?0:1/0);if(t)if(n.length>1)s=!0;else{for(r=n[0];r%10===0;)r/=10;s=r!==1}if(_=!1,u=l+p,o=ce(c,u),i=t?_e(f,u+10):ce(e,u),a=P(o,i,u,1),we(a.d,r=l,h))do if(u+=10,o=ce(c,u),i=t?_e(f,u+10):ce(e,u),a=P(o,i,u,1),!s){+j(a.d).slice(r+1,r+15)+1==1e14&&(a=S(a,l+1,0));break}while(we(a.d,r+=10,h));return _=!0,S(a,l,h)},d.minus=d.sub=function(e){var t,n,i,r,s,o,u,a,c,f,l,h,p=this,w=p.constructor;if(e=new w(e),!p.d||!e.d)return!p.s||!e.s?e=new w(NaN):p.d?e.s=-e.s:e=new w(e.d||p.s!==e.s?p:NaN),e;if(p.s!=e.s)return e.s=-e.s,p.plus(e);if(c=p.d,h=e.d,u=w.precision,a=w.rounding,!c[0]||!h[0]){if(h[0])e.s=-e.s;else if(c[0])e=new w(p);else return new w(a===3?-0:0);return _?S(e,u,a):e}if(n=W(e.e/k),f=W(p.e/k),c=c.slice(),s=f-n,s){for(l=s<0,l?(t=c,s=-s,o=h.length):(t=h,n=f,o=c.length),i=Math.max(Math.ceil(u/k),o)+2,s>i&&(s=i,t.length=1),t.reverse(),i=s;i--;)t.push(0);t.reverse()}else{for(i=c.length,o=h.length,l=i<o,l&&(o=i),i=0;i<o;i++)if(c[i]!=h[i]){l=c[i]<h[i];break}s=0}for(l&&(t=c,c=h,h=t,e.s=-e.s),o=c.length,i=h.length-o;i>0;--i)c[o++]=0;for(i=h.length;i>s;){if(c[--i]<h[i]){for(r=i;r&&c[--r]===0;)c[r]=K-1;--c[r],c[i]+=K}c[i]-=h[i]}for(;c[--o]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(e.d=c,e.e=ke(c,n),_?S(e,u,a):e):new w(a===3?-0:0)},d.modulo=d.mod=function(e){var t,n=this,i=n.constructor;return e=new i(e),!n.d||!e.s||e.d&&!e.d[0]?new i(NaN):!e.d||n.d&&!n.d[0]?S(new i(n),i.precision,i.rounding):(_=!1,i.modulo==9?(t=P(n,e.abs(),0,3,1),t.s*=e.s):t=P(n,e,0,i.modulo,1),t=t.times(e),_=!0,n.minus(t))},d.naturalExponential=d.exp=function(){return Ae(this)},d.naturalLogarithm=d.ln=function(){return ce(this)},d.negated=d.neg=function(){var e=new this.constructor(this);return e.s=-e.s,S(e)},d.plus=d.add=function(e){var t,n,i,r,s,o,u,a,c,f,l=this,h=l.constructor;if(e=new h(e),!l.d||!e.d)return!l.s||!e.s?e=new h(NaN):l.d||(e=new h(e.d||l.s===e.s?l:NaN)),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(c=l.d,f=e.d,u=h.precision,a=h.rounding,!c[0]||!f[0])return f[0]||(e=new h(l)),_?S(e,u,a):e;if(s=W(l.e/k),i=W(e.e/k),c=c.slice(),r=s-i,r){for(r<0?(n=c,r=-r,o=f.length):(n=f,i=s,o=c.length),s=Math.ceil(u/k),o=s>o?s+1:o+1,r>o&&(r=o,n.length=1),n.reverse();r--;)n.push(0);n.reverse()}for(o=c.length,r=f.length,o-r<0&&(r=o,n=f,f=c,c=n),t=0;r;)t=(c[--r]=c[r]+f[r]+t)/K|0,c[r]%=K;for(t&&(c.unshift(t),++i),o=c.length;c[--o]==0;)c.pop();return e.d=c,e.e=ke(c,i),_?S(e,u,a):e},d.precision=d.sd=function(e){var t,n=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(oe+e);return n.d?(t=je(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},d.round=function(){var e=this,t=e.constructor;return S(new t(e),e.e+1,t.rounding)},d.sine=d.sin=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+Math.max(n.e,n.sd())+k,i.rounding=1,n=Tt(i,xe(i,n)),i.precision=e,i.rounding=t,S(ie>2?n.neg():n,e,t,!0)):new i(NaN)},d.squareRoot=d.sqrt=function(){var e,t,n,i,r,s,o=this,u=o.d,a=o.e,c=o.s,f=o.constructor;if(c!==1||!u||!u[0])return new f(!c||c<0&&(!u||u[0])?NaN:u?o:1/0);for(_=!1,c=Math.sqrt(+o),c==0||c==1/0?(t=j(u),(t.length+a)%2==0&&(t+="0"),c=Math.sqrt(t),a=W((a+1)/2)-(a<0||a%2),c==1/0?t="5e"+a:(t=c.toExponential(),t=t.slice(0,t.indexOf("e")+1)+a),i=new f(t)):i=new f(c.toString()),n=(a=f.precision)+3;;)if(s=i,i=s.plus(P(o,s,n+2,1)).times(.5),j(s.d).slice(0,n)===(t=j(i.d)).slice(0,n))if(t=t.slice(n-3,n+1),t=="9999"||!r&&t=="4999"){if(!r&&(S(s,a+1,0),s.times(s).eq(o))){i=s;break}n+=4,r=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(S(i,a+1,1),e=!i.times(i).eq(o));break}return _=!0,S(i,a,f.rounding,e)},d.tangent=d.tan=function(){var e,t,n=this,i=n.constructor;return n.isFinite()?n.isZero()?new i(n):(e=i.precision,t=i.rounding,i.precision=e+10,i.rounding=1,n=n.sin(),n.s=1,n=P(n,new i(1).minus(n.times(n)).sqrt(),e+10,0),i.precision=e,i.rounding=t,S(ie==2||ie==4?n.neg():n,e,t,!0)):new i(NaN)},d.times=d.mul=function(e){var t,n,i,r,s,o,u,a,c,f=this,l=f.constructor,h=f.d,p=(e=new l(e)).d;if(e.s*=f.s,!h||!h[0]||!p||!p[0])return new l(!e.s||h&&!h[0]&&!p||p&&!p[0]&&!h?NaN:!h||!p?e.s/0:e.s*0);for(n=W(f.e/k)+W(e.e/k),a=h.length,c=p.length,a<c&&(s=h,h=p,p=s,o=a,a=c,c=o),s=[],o=a+c,i=o;i--;)s.push(0);for(i=c;--i>=0;){for(t=0,r=a+i;r>i;)u=s[r]+p[i]*h[r-i-1]+t,s[r--]=u%K|0,t=u/K|0;s[r]=(s[r]+t)%K|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=ke(s,n),_?S(e,l.precision,l.rounding):e},d.toBinary=function(e,t){return Fe(this,2,e,t)},d.toDecimalPlaces=d.toDP=function(e,t){var n=this,i=n.constructor;return n=new i(n),e===void 0?n:(z(e,0,se),t===void 0?t=i.rounding:z(t,0,8),S(n,e+n.e+1,t))},d.toExponential=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=te(i,!0):(z(e,0,se),t===void 0?t=r.rounding:z(t,0,8),i=S(new r(i),e+1,t),n=te(i,!0,e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},d.toFixed=function(e,t){var n,i,r=this,s=r.constructor;return e===void 0?n=te(r):(z(e,0,se),t===void 0?t=s.rounding:z(t,0,8),i=S(new s(r),e+r.e+1,t),n=te(i,!1,e+i.e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},d.toFraction=function(e){var t,n,i,r,s,o,u,a,c,f,l,h,p=this,w=p.d,M=p.constructor;if(!w)return new M(p);if(c=n=new M(1),i=a=new M(0),t=new M(i),s=t.e=je(w)-p.e-1,o=s%k,t.d[0]=Y(10,o<0?k+o:o),e==null)e=s>0?t:c;else{if(u=new M(e),!u.isInt()||u.lt(c))throw Error(oe+u);e=u.gt(t)?s>0?t:c:u}for(_=!1,u=new M(j(w)),f=M.precision,M.precision=s=w.length*k*2;l=P(u,t,0,1,1),r=n.plus(l.times(i)),r.cmp(e)!=1;)n=i,i=r,r=c,c=a.plus(l.times(r)),a=r,r=t,t=u.minus(l.times(r)),u=r;return r=P(e.minus(n),i,0,1,1),a=a.plus(r.times(c)),n=n.plus(r.times(i)),a.s=c.s=p.s,h=P(c,i,s,1).minus(p).abs().cmp(P(a,n,s,1).minus(p).abs())<1?[c,i]:[a,n],M.precision=f,_=!0,h},d.toHexadecimal=d.toHex=function(e,t){return Fe(this,16,e,t)},d.toNearest=function(e,t){var n=this,i=n.constructor;if(n=new i(n),e==null){if(!n.d)return n;e=new i(1),t=i.rounding}else{if(e=new i(e),t===void 0?t=i.rounding:z(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(_=!1,n=P(n,e,0,t,1).times(e),_=!0,S(n)):(e.s=n.s,n=e),n},d.toNumber=function(){return+this},d.toOctal=function(e,t){return Fe(this,8,e,t)},d.toPower=d.pow=function(e){var t,n,i,r,s,o,u=this,a=u.constructor,c=+(e=new a(e));if(!u.d||!e.d||!u.d[0]||!e.d[0])return new a(Y(+u,c));if(u=new a(u),u.eq(1))return u;if(i=a.precision,s=a.rounding,e.eq(1))return S(u,i,s);if(t=W(e.e/k),t>=e.d.length-1&&(n=c<0?-c:c)<=Et)return r=We(a,u,n,i),e.s<0?new a(1).div(r):S(r,i,s);if(o=u.s,o<0){if(t<e.d.length-1)return new a(NaN);if(e.d[t]&1||(o=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=o,u}return n=Y(+u,c),t=n==0||!isFinite(n)?W(c*(Math.log("0."+j(u.d))/Math.LN10+u.e+1)):new a(n+"").e,t>a.maxE+1||t<a.minE-1?new a(t>0?o/0:0):(_=!1,a.rounding=u.s=1,n=Math.min(12,(t+"").length),r=Ae(e.times(ce(u,i+n)),i),r.d&&(r=S(r,i+5,1),we(r.d,i,s)&&(t=i+10,r=S(Ae(e.times(ce(u,t+n)),t),t+5,1),+j(r.d).slice(i+1,i+15)+1==1e14&&(r=S(r,i+1,0)))),r.s=o,_=!0,a.rounding=s,S(r,i,s))},d.toPrecision=function(e,t){var n,i=this,r=i.constructor;return e===void 0?n=te(i,i.e<=r.toExpNeg||i.e>=r.toExpPos):(z(e,1,se),t===void 0?t=r.rounding:z(t,0,8),i=S(new r(i),e,t),n=te(i,e<=i.e||i.e<=r.toExpNeg,e)),i.isNeg()&&!i.isZero()?"-"+n:n},d.toSignificantDigits=d.toSD=function(e,t){var n=this,i=n.constructor;return e===void 0?(e=i.precision,t=i.rounding):(z(e,1,se),t===void 0?t=i.rounding:z(t,0,8)),S(new i(n),e,t)},d.toString=function(){var e=this,t=e.constructor,n=te(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},d.truncated=d.trunc=function(){return S(new this.constructor(this),this.e+1,1)},d.valueOf=d.toJSON=function(){var e=this,t=e.constructor,n=te(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};function j(e){var t,n,i,r=e.length-1,s="",o=e[0];if(r>0){for(s+=o,t=1;t<r;t++)i=e[t]+"",n=k-i.length,n&&(s+=ue(n)),s+=i;o=e[t],i=o+"",n=k-i.length,n&&(s+=ue(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function z(e,t,n){if(e!==~~e||e<t||e>n)throw Error(oe+e)}function we(e,t,n,i){var r,s,o,u;for(s=e[0];s>=10;s/=10)--t;return--t<0?(t+=k,r=0):(r=Math.ceil((t+1)/k),t%=k),s=Y(10,k-t),u=e[r]%s|0,i==null?t<3?(t==0?u=u/100|0:t==1&&(u=u/10|0),o=n<4&&u==99999||n>3&&u==49999||u==5e4||u==0):o=(n<4&&u+1==s||n>3&&u+1==s/2)&&(e[r+1]/s/100|0)==Y(10,t-2)-1||(u==s/2||u==0)&&(e[r+1]/s/100|0)==0:t<4?(t==0?u=u/1e3|0:t==1?u=u/100|0:t==2&&(u=u/10|0),o=(i||n<4)&&u==9999||!i&&n>3&&u==4999):o=((i||n<4)&&u+1==s||!i&&n>3&&u+1==s/2)&&(e[r+1]/s/1e3|0)==Y(10,t-3)-1,o}function Ee(e,t,n){for(var i,r=[0],s,o=0,u=e.length;o<u;){for(s=r.length;s--;)r[s]*=t;for(r[0]+=ye.indexOf(e.charAt(o++)),i=0;i<r.length;i++)r[i]>n-1&&(r[i+1]===void 0&&(r[i+1]=0),r[i+1]+=r[i]/n|0,r[i]%=n)}return r.reverse()}function _t(e,t){var n,i,r;if(t.isZero())return t;i=t.d.length,i<32?(n=Math.ceil(i/3),r=(1/Oe(4,n)).toString()):(n=16,r="2.3283064365386962890625e-10"),e.precision+=n,t=pe(e,1,t.times(r),new e(1));for(var s=n;s--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=n,t}var P=function(){function e(i,r,s){var o,u=0,a=i.length;for(i=i.slice();a--;)o=i[a]*r+u,i[a]=o%s|0,u=o/s|0;return u&&i.unshift(u),i}function t(i,r,s,o){var u,a;if(s!=o)a=s>o?1:-1;else for(u=a=0;u<s;u++)if(i[u]!=r[u]){a=i[u]>r[u]?1:-1;break}return a}function n(i,r,s,o){for(var u=0;s--;)i[s]-=u,u=i[s]<r[s]?1:0,i[s]=u*o+i[s]-r[s];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,s,o,u,a){var c,f,l,h,p,w,M,F,A,H,O,q,x,T,E,v,L,y,b,R,U=i.constructor,N=i.s==r.s?1:-1,g=i.d,m=r.d;if(!g||!g[0]||!m||!m[0])return new U(!i.s||!r.s||(g?m&&g[0]==m[0]:!m)?NaN:g&&g[0]==0||!m?N*0:N/0);for(a?(p=1,f=i.e-r.e):(a=K,p=k,f=W(i.e/p)-W(r.e/p)),b=m.length,L=g.length,A=new U(N),H=A.d=[],l=0;m[l]==(g[l]||0);l++);if(m[l]>(g[l]||0)&&f--,s==null?(T=s=U.precision,o=U.rounding):u?T=s+(i.e-r.e)+1:T=s,T<0)H.push(1),w=!0;else{if(T=T/p+2|0,l=0,b==1){for(h=0,m=m[0],T++;(l<L||h)&&T--;l++)E=h*a+(g[l]||0),H[l]=E/m|0,h=E%m|0;w=h||l<L}else{for(h=a/(m[0]+1)|0,h>1&&(m=e(m,h,a),g=e(g,h,a),b=m.length,L=g.length),v=b,O=g.slice(0,b),q=O.length;q<b;)O[q++]=0;R=m.slice(),R.unshift(0),y=m[0],m[1]>=a/2&&++y;do h=0,c=t(m,O,b,q),c<0?(x=O[0],b!=q&&(x=x*a+(O[1]||0)),h=x/y|0,h>1?(h>=a&&(h=a-1),M=e(m,h,a),F=M.length,q=O.length,c=t(M,O,F,q),c==1&&(h--,n(M,b<F?R:m,F,a))):(h==0&&(c=h=1),M=m.slice()),F=M.length,F<q&&M.unshift(0),n(O,M,q,a),c==-1&&(q=O.length,c=t(m,O,b,q),c<1&&(h++,n(O,b<q?R:m,q,a))),q=O.length):c===0&&(h++,O=[0]),H[l++]=h,c&&O[0]?O[q++]=g[v]||0:(O=[g[v]],q=1);while((v++<L||O[0]!==void 0)&&T--);w=O[0]!==void 0}H[0]||H.shift()}if(p==1)A.e=f,Ue=w;else{for(l=1,h=H[0];h>=10;h/=10)l++;A.e=l+f*p-1,S(A,u?s+A.e+1:s,o,w)}return A}}();function S(e,t,n,i){var r,s,o,u,a,c,f,l,h,p=e.constructor;e:if(t!=null){if(l=e.d,!l)return e;for(r=1,u=l[0];u>=10;u/=10)r++;if(s=t-r,s<0)s+=k,o=t,f=l[h=0],a=f/Y(10,r-o-1)%10|0;else if(h=Math.ceil((s+1)/k),u=l.length,h>=u)if(i){for(;u++<=h;)l.push(0);f=a=0,r=1,s%=k,o=s-k+1}else break e;else{for(f=u=l[h],r=1;u>=10;u/=10)r++;s%=k,o=s-k+r,a=o<0?0:f/Y(10,r-o-1)%10|0}if(i=i||t<0||l[h+1]!==void 0||(o<0?f:f%Y(10,r-o-1)),c=n<4?(a||i)&&(n==0||n==(e.s<0?3:2)):a>5||a==5&&(n==4||i||n==6&&(s>0?o>0?f/Y(10,r-o):0:l[h-1])%10&1||n==(e.s<0?8:7)),t<1||!l[0])return l.length=0,c?(t-=e.e+1,l[0]=Y(10,(k-t%k)%k),e.e=-t||0):l[0]=e.e=0,e;if(s==0?(l.length=h,u=1,h--):(l.length=h+1,u=Y(10,k-s),l[h]=o>0?(f/Y(10,r-o)%Y(10,o)|0)*u:0),c)for(;;)if(h==0){for(s=1,o=l[0];o>=10;o/=10)s++;for(o=l[0]+=u,u=1;o>=10;o/=10)u++;s!=u&&(e.e++,l[0]==K&&(l[0]=1));break}else{if(l[h]+=u,l[h]!=K)break;l[h--]=0,u=1}for(s=l.length;l[--s]===0;)l.pop()}return _&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function te(e,t,n){if(!e.isFinite())return Ge(e);var i,r=e.e,s=j(e.d),o=s.length;return t?(n&&(i=n-o)>0?s=s.charAt(0)+"."+s.slice(1)+ue(i):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):r<0?(s="0."+ue(-r-1)+s,n&&(i=n-o)>0&&(s+=ue(i))):r>=o?(s+=ue(r+1-o),n&&(i=n-r-1)>0&&(s=s+"."+ue(i))):((i=r+1)<o&&(s=s.slice(0,i)+"."+s.slice(i)),n&&(i=n-o)>0&&(r+1===o&&(s+="."),s+=ue(i))),s}function ke(e,t){var n=e[0];for(t*=k;n>=10;n/=10)t++;return t}function _e(e,t,n){if(t>kt)throw _=!0,n&&(e.precision=n),Error(Be);return S(new e(Ne),t,1,!0)}function Q(e,t,n){if(t>Ie)throw Error(Be);return S(new e(Se),t,n,!0)}function je(e){var t=e.length-1,n=t*k+1;if(t=e[t],t){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function ue(e){for(var t="";e--;)t+="0";return t}function We(e,t,n,i){var r,s=new e(1),o=Math.ceil(i/k+4);for(_=!1;;){if(n%2&&(s=s.times(t),Xe(s.d,o)&&(r=!0)),n=W(n/2),n===0){n=s.d.length-1,r&&s.d[n]===0&&++s.d[n];break}t=t.times(t),Xe(t.d,o)}return _=!0,s}function Ve(e){return e.d[e.d.length-1]&1}function ze(e,t,n){for(var i,r=new e(t[0]),s=0;++s<t.length;)if(i=new e(t[s]),i.s)r[n](i)&&(r=i);else{r=i;break}return r}function Ae(e,t){var n,i,r,s,o,u,a,c=0,f=0,l=0,h=e.constructor,p=h.rounding,w=h.precision;if(!e.d||!e.d[0]||e.e>17)return new h(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:0/0);for(t==null?(_=!1,a=w):a=t,u=new h(.03125);e.e>-2;)e=e.times(u),l+=5;for(i=Math.log(Y(2,l))/Math.LN10*2+5|0,a+=i,n=s=o=new h(1),h.precision=a;;){if(s=S(s.times(e),a,1),n=n.times(++f),u=o.plus(P(s,n,a,1)),j(u.d).slice(0,a)===j(o.d).slice(0,a)){for(r=l;r--;)o=S(o.times(o),a,1);if(t==null)if(c<3&&we(o.d,a-i,p,c))h.precision=a+=10,n=s=u=new h(1),f=0,c++;else return S(o,h.precision=w,p,_=!0);else return h.precision=w,o}o=u}}function ce(e,t){var n,i,r,s,o,u,a,c,f,l,h,p=1,w=10,M=e,F=M.d,A=M.constructor,H=A.rounding,O=A.precision;if(M.s<0||!F||!F[0]||!M.e&&F[0]==1&&F.length==1)return new A(F&&!F[0]?-1/0:M.s!=1?NaN:F?0:M);if(t==null?(_=!1,f=O):f=t,A.precision=f+=w,n=j(F),i=n.charAt(0),Math.abs(s=M.e)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)M=M.times(e),n=j(M.d),i=n.charAt(0),p++;s=M.e,i>1?(M=new A("0."+n),s++):M=new A(i+"."+n.slice(1))}else return c=_e(A,f+2,O).times(s+""),M=ce(new A(i+"."+n.slice(1)),f-w).plus(c),A.precision=O,t==null?S(M,O,H,_=!0):M;for(l=M,a=o=M=P(M.minus(1),M.plus(1),f,1),h=S(M.times(M),f,1),r=3;;){if(o=S(o.times(h),f,1),c=a.plus(P(o,new A(r),f,1)),j(c.d).slice(0,f)===j(a.d).slice(0,f))if(a=a.times(2),s!==0&&(a=a.plus(_e(A,f+2,O).times(s+""))),a=P(a,new A(p),f,1),t==null)if(we(a.d,f-w,H,u))A.precision=f+=w,c=o=M=P(l.minus(1),l.plus(1),f,1),h=S(M.times(M),f,1),r=u=1;else return S(a,A.precision=O,H,_=!0);else return A.precision=O,a;a=c,r+=2}}function Ge(e){return String(e.s*e.s/0)}function Le(e,t){var n,i,r;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(n<0&&(n=i),n+=+t.slice(i+1),t=t.substring(0,i)):n<0&&(n=t.length),i=0;t.charCodeAt(i)===48;i++);for(r=t.length;t.charCodeAt(r-1)===48;--r);if(t=t.slice(i,r),t){if(r-=i,e.e=n=n-i-1,e.d=[],i=(n+1)%k,n<0&&(i+=k),i<r){for(i&&e.d.push(+t.slice(0,i)),r-=k;i<r;)e.d.push(+t.slice(i,i+=k));t=t.slice(i),i=k-t.length}else i-=r;for(;i--;)t+="0";e.d.push(+t),_&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Ot(e,t){var n,i,r,s,o,u,a,c,f;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),Ze.test(t))return Le(e,t)}else if(t==="Infinity"||t==="NaN")return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(St.test(t))n=16,t=t.toLowerCase();else if(Nt.test(t))n=2;else if(Dt.test(t))n=8;else throw Error(oe+t);for(s=t.search(/p/i),s>0?(a=+t.slice(s+1),t=t.substring(2,s)):t=t.slice(2),s=t.indexOf("."),o=s>=0,i=e.constructor,o&&(t=t.replace(".",""),u=t.length,s=u-s,r=We(i,new i(n),s,s*2)),c=Ee(t,n,K),f=c.length-1,s=f;c[s]===0;--s)c.pop();return s<0?new i(e.s*0):(e.e=ke(c,f),e.d=c,_=!1,o&&(e=P(e,r,u*4)),a&&(e=e.times(Math.abs(a)<54?Y(2,a):re.pow(2,a))),_=!0,e)}function Tt(e,t){var n,i=t.d.length;if(i<3)return t.isZero()?t:pe(e,2,t,t);n=1.4*Math.sqrt(i),n=n>16?16:n|0,t=t.times(1/Oe(5,n)),t=pe(e,2,t,t);for(var r,s=new e(5),o=new e(16),u=new e(20);n--;)r=t.times(t),t=t.times(s.plus(r.times(o.times(r).minus(u))));return t}function pe(e,t,n,i,r){var s,o,u,a,c=e.precision,f=Math.ceil(c/k);for(_=!1,a=n.times(n),u=new e(i);;){if(o=P(u.times(a),new e(t++*t++),c,1),u=r?i.plus(o):i.minus(o),i=P(o.times(a),new e(t++*t++),c,1),o=u.plus(i),o.d[f]!==void 0){for(s=f;o.d[s]===u.d[s]&&s--;);if(s==-1)break}s=u,u=i,i=o,o=s}return _=!0,o.d.length=f+1,o}function Oe(e,t){for(var n=e;--t;)n*=e;return n}function xe(e,t){var n,i=t.s<0,r=Q(e,e.precision,1),s=r.times(.5);if(t=t.abs(),t.lte(s))return ie=i?4:1,t;if(n=t.divToInt(r),n.isZero())ie=i?3:2;else{if(t=t.minus(n.times(r)),t.lte(s))return ie=Ve(n)?i?2:3:i?4:1,t;ie=Ve(n)?i?1:4:i?3:2}return t.minus(r).abs()}function Fe(e,t,n,i){var r,s,o,u,a,c,f,l,h,p=e.constructor,w=n!==void 0;if(w?(z(n,1,se),i===void 0?i=p.rounding:z(i,0,8)):(n=p.precision,i=p.rounding),!e.isFinite())f=Ge(e);else{for(f=te(e),o=f.indexOf("."),w?(r=2,t==16?n=n*4-3:t==8&&(n=n*3-2)):r=t,o>=0&&(f=f.replace(".",""),h=new p(1),h.e=f.length-o,h.d=Ee(te(h),10,r),h.e=h.d.length),l=Ee(f,10,r),s=a=l.length;l[--a]==0;)l.pop();if(!l[0])f=w?"0p+0":"0";else{if(o<0?s--:(e=new p(e),e.d=l,e.e=s,e=P(e,h,n,i,0,r),l=e.d,s=e.e,c=Ue),o=l[n],u=r/2,c=c||l[n+1]!==void 0,c=i<4?(o!==void 0||c)&&(i===0||i===(e.s<0?3:2)):o>u||o===u&&(i===4||c||i===6&&l[n-1]&1||i===(e.s<0?8:7)),l.length=n,c)for(;++l[--n]>r-1;)l[n]=0,n||(++s,l.unshift(1));for(a=l.length;!l[a-1];--a);for(o=0,f="";o<a;o++)f+=ye.charAt(l[o]);if(w){if(a>1)if(t==16||t==8){for(o=t==16?4:3,--a;a%o;a++)f+="0";for(l=Ee(f,r,t),a=l.length;!l[a-1];--a);for(o=1,f="1.";o<a;o++)f+=ye.charAt(l[o])}else f=f.charAt(0)+"."+f.slice(1);f=f+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)f="0"+f;f="0."+f}else if(++s>a)for(s-=a;s--;)f+="0";else s<a&&(f=f.slice(0,s)+"."+f.slice(s))}f=(t==16?"0x":t==2?"0b":t==8?"0o":"")+f}return e.s<0?"-"+f:f}function Xe(e,t){if(e.length>t)return e.length=t,!0}function yt(e){return new this(e).abs()}function Ct(e){return new this(e).acos()}function It(e){return new this(e).acosh()}function At(e,t){return new this(e).plus(t)}function Lt(e){return new this(e).asin()}function Ft(e){return new this(e).asinh()}function Pt(e){return new this(e).atan()}function Jt(e){return new this(e).atanh()}function Rt(e,t){e=new this(e),t=new this(t);var n,i=this.precision,r=this.rounding,s=i+4;return!e.s||!t.s?n=new this(NaN):!e.d&&!t.d?(n=Q(this,s,1).times(t.s>0?.25:.75),n.s=e.s):!t.d||e.isZero()?(n=t.s<0?Q(this,i,r):new this(0),n.s=e.s):!e.d||t.isZero()?(n=Q(this,s,1).times(.5),n.s=e.s):t.s<0?(this.precision=s,this.rounding=1,n=this.atan(P(e,t,s,1)),t=Q(this,s,1),this.precision=i,this.rounding=r,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(P(e,t,s,1)),n}function qt(e){return new this(e).cbrt()}function Ut(e){return S(e=new this(e),e.e+1,2)}function Bt(e,t,n){return new this(e).clamp(t,n)}function Ht(e){if(!e||typeof e!="object")throw Error(De+"Object expected");var t,n,i,r=e.defaults===!0,s=["precision",1,se,"rounding",0,8,"toExpNeg",-me,0,"toExpPos",0,me,"maxE",0,me,"minE",-me,0,"modulo",0,9];for(t=0;t<s.length;t+=3)if(n=s[t],r&&(this[n]=Ce[n]),(i=e[n])!==void 0)if(W(i)===i&&i>=s[t+1]&&i<=s[t+2])this[n]=i;else throw Error(oe+n+": "+i);if(n="crypto",r&&(this[n]=Ce[n]),(i=e[n])!==void 0)if(i===!0||i===!1||i===0||i===1)if(i)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[n]=!0;else throw Error(He);else this[n]=!1;else throw Error(oe+n+": "+i);return this}function Yt(e){return new this(e).cos()}function Zt(e){return new this(e).cosh()}function Ke(e){var t,n,i;function r(s){var o,u,a,c=this;if(!(c instanceof r))return new r(s);if(c.constructor=r,Qe(s)){c.s=s.s,_?!s.d||s.e>r.maxE?(c.e=NaN,c.d=null):s.e<r.minE?(c.e=0,c.d=[0]):(c.e=s.e,c.d=s.d.slice()):(c.e=s.e,c.d=s.d?s.d.slice():s.d);return}if(a=typeof s,a==="number"){if(s===0){c.s=1/s<0?-1:1,c.e=0,c.d=[0];return}if(s<0?(s=-s,c.s=-1):c.s=1,s===~~s&&s<1e7){for(o=0,u=s;u>=10;u/=10)o++;_?o>r.maxE?(c.e=NaN,c.d=null):o<r.minE?(c.e=0,c.d=[0]):(c.e=o,c.d=[s]):(c.e=o,c.d=[s]);return}else if(s*0!==0){s||(c.s=NaN),c.e=NaN,c.d=null;return}return Le(c,s.toString())}else if(a!=="string")throw Error(oe+s);return(u=s.charCodeAt(0))===45?(s=s.slice(1),c.s=-1):(u===43&&(s=s.slice(1)),c.s=1),Ze.test(s)?Le(c,s):Ot(c,s)}if(r.prototype=d,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.EUCLID=9,r.config=r.set=Ht,r.clone=Ke,r.isDecimal=Qe,r.abs=yt,r.acos=Ct,r.acosh=It,r.add=At,r.asin=Lt,r.asinh=Ft,r.atan=Pt,r.atanh=Jt,r.atan2=Rt,r.cbrt=qt,r.ceil=Ut,r.clamp=Bt,r.cos=Yt,r.cosh=Zt,r.div=jt,r.exp=Wt,r.floor=Vt,r.hypot=zt,r.ln=Gt,r.log=xt,r.log10=Kt,r.log2=Xt,r.max=Qt,r.min=en,r.mod=tn,r.mul=nn,r.pow=rn,r.random=sn,r.round=on,r.sign=un,r.sin=cn,r.sinh=an,r.sqrt=fn,r.sub=ln,r.sum=hn,r.tan=dn,r.tanh=mn,r.trunc=pn,e===void 0&&(e={}),e&&e.defaults!==!0)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return r.config(e),r}function jt(e,t){return new this(e).div(t)}function Wt(e){return new this(e).exp()}function Vt(e){return S(e=new this(e),e.e+1,3)}function zt(){var e,t,n=new this(0);for(_=!1,e=0;e<arguments.length;)if(t=new this(arguments[e++]),t.d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return _=!0,new this(1/0);n=t}return _=!0,n.sqrt()}function Qe(e){return e instanceof re||e&&e.toStringTag===Ye||!1}function Gt(e){return new this(e).ln()}function xt(e,t){return new this(e).log(t)}function Xt(e){return new this(e).log(2)}function Kt(e){return new this(e).log(10)}function Qt(){return ze(this,arguments,"lt")}function en(){return ze(this,arguments,"gt")}function tn(e,t){return new this(e).mod(t)}function nn(e,t){return new this(e).mul(t)}function rn(e,t){return new this(e).pow(t)}function sn(e){var t,n,i,r,s=0,o=new this(1),u=[];if(e===void 0?e=this.precision:z(e,1,se),i=Math.ceil(e/k),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(i));s<i;)r=t[s],r>=429e7?t[s]=crypto.getRandomValues(new Uint32Array(1))[0]:u[s++]=r%1e7;else if(crypto.randomBytes){for(t=crypto.randomBytes(i*=4);s<i;)r=t[s]+(t[s+1]<<8)+(t[s+2]<<16)+((t[s+3]&127)<<24),r>=214e7?crypto.randomBytes(4).copy(t,s):(u.push(r%1e7),s+=4);s=i/4}else throw Error(He);else for(;s<i;)u[s++]=Math.random()*1e7|0;for(i=u[--s],e%=k,i&&e&&(r=Y(10,k-e),u[s]=(i/r|0)*r);u[s]===0;s--)u.pop();if(s<0)n=0,u=[0];else{for(n=-1;u[0]===0;n-=k)u.shift();for(i=1,r=u[0];r>=10;r/=10)i++;i<k&&(n-=k-i)}return o.e=n,o.d=u,o}function on(e){return S(e=new this(e),e.e+1,this.rounding)}function un(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function cn(e){return new this(e).sin()}function an(e){return new this(e).sinh()}function fn(e){return new this(e).sqrt()}function ln(e,t){return new this(e).sub(t)}function hn(){var e=0,t=arguments,n=new this(t[e]);for(_=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return _=!0,S(n,this.precision,this.rounding)}function dn(e){return new this(e).tan()}function mn(e){return new this(e).tanh()}function pn(e){return S(e=new this(e),e.e+1,1)}d[Symbol.for("nodejs.util.inspect.custom")]=d.toString,d[Symbol.toStringTag]="Decimal";var re=d.constructor=Ke(Ce);Ne=new re(Ne),Se=new re(Se);const gn=(e,t)=>{const n=new re(e),i=Object.entries(t).sort(([,r],[,s])=>s-r);for(const[r,s]of i){const o=new re(s);if(n.greaterThanOrEqualTo(o))return[n.dividedBy(o).toFixed(2),r]}return[n.toFixed(2),""]},wn=(e,t=2)=>{e=e.replace(/\s+/g,"");const n={"+":1,"-":1,"*":2,"/":2},i=u=>new re(u),r=u=>["+","-","*","/"].includes(u),s=u=>/[0-9.]/.test(u),o=u=>{const a=[],c=[];let f=0;for(;f<u.length;){const h=u[f];if(s(h)){let p="";for(;f<u.length&&s(u[f]);)p+=u[f],f++;a.push(i(p))}else if(h==="(")c.push(h),f++;else if(h===")"){for(;c.length>0&&c[c.length-1]!=="(";)a.push(c.pop());c.pop(),f++}else if(r(h)){for(;c.length>0&&n[c[c.length-1]]>=n[h];)a.push(c.pop());c.push(h),f++}else throw new Error(`无效字符: ${h}`)}for(;c.length>0;)a.push(c.pop());const l=[];for(let h of a)if(typeof h=="string"){const p=l.pop(),w=l.pop();switch(h){case"+":l.push(w.add(p));break;case"-":l.push(w.sub(p));break;case"*":l.push(w.mul(p));break;case"/":if(p.eq(0))throw new Error("除数不能为零");l.push(w.div(p));break}}else l.push(h);return l.pop()};try{const u=o(e);return Number(u.toFixed(t))}catch(u){throw new Error("表达式计算失败:"+u.message)}},vn=(e,t)=>{if(t==="rad")return e*(Math.PI/180);if(t==="deg")return e*(180/Math.PI);throw new Error("请使用正确类型")},$n=(e,t)=>{const n=t.x-e.x,i=t.y-e.y;let s=Math.atan2(i,n)*(180/Math.PI);return s=-s+90,s<0&&(s+=360),s},Mn=(e,t)=>{const n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)},bn=(e,t,n,i=2)=>{const s={"+":(o,u)=>o.add(u),"-":(o,u)=>o.sub(u),"*":(o,u)=>o.mul(u),"/":(o,u)=>{if(u.eq(0))throw new Error("除数不能为0");return o.div(u)}}[n](new re(e),new re(t));return Number(s.toFixed(i))},Nn=(e,t)=>t.reduce((n,i)=>{const{key:r,verify:s,msg:o,name:u}=i,a=e[r];return a===""||a===void 0||a===null?n.push({key:r,msg:"必填项",name:u}):(typeof s=="function"?!s(a):!s.test(a))&&n.push({key:r,msg:o,name:u}),n},[]),Sn=({promiseFn:e,maxRetries:t=3,retryDelay:n=2e3,params:i=void 0})=>new Promise((r,s)=>{let o=0;const u=()=>{e(i).then(a=>{r(a)}).catch(a=>{if(o++,o>=t){s(a);return}setTimeout(u,n)})};u()}),Dn=e=>Math.random()*100<e,En=(e,t,n=0)=>parseFloat((Math.random()*(t-e)+e).toFixed(n)),kn=(e=1)=>{const t=Math.floor(Math.random()*256),n=Math.floor(Math.random()*256),i=Math.floor(Math.random()*256);return`rgba(${t}, ${n}, ${i}, ${e})`},_n=(e,t,n)=>{const i=Array.from({length:t-e+1},(r,s)=>s+e);for(let r=i.length-1;r>0;r--){const s=Math.floor(Math.random()*(r+1));[i[r],i[s]]=[i[s],i[r]]}return i.slice(0,n)},On=(e,t)=>{const n=be(e).startOf(t),i=be().startOf(t);return n.isSame(i)?0:n.isBefore(i)?1:-1},Tn=e=>{const t=[{unit:"年",milliseconds:31536e6},{unit:"月",milliseconds:2592e6},{unit:"周",milliseconds:6048e5},{unit:"天",milliseconds:864e5},{unit:"小时",milliseconds:36e5},{unit:"分钟",milliseconds:6e4}],i=Date.now()-e;for(const{unit:r,milliseconds:s}of t)if(i>=s)return`${Math.floor(i/s)} ${r}前`;return"刚刚"},yn=(e={})=>{const{midnight:t="午夜好",morning:n="早上好",forenoon:i="上午好",noon:r="中午好",afternoon:s="下午好",evening:o="晚上好"}=e,u=new Date().getHours();return u<4?t:u<10?n:u<12?i:u<14?r:u<18?s:o};class Cn{constructor(t,n){de(this,"_onChange");de(this,"_isDown",!1);de(this,"_currentIndex",0);de(this,"_timerId");de(this,"_intervalId");de(this,"_numsLength",0);this._onChange=n,this._numsLength=t,window.addEventListener("pointerup",()=>{this._isDown&&this._up()})}down(t){this._isDown=!0,this._handleChange(t),this._timerId=setTimeout(()=>{this._isDown&&(this._intervalId=setInterval(()=>{this._handleChange(t)},100))},100)}updateIndex(t){this._currentIndex=t}_up(){this._isDown=!1,clearTimeout(this._timerId),clearInterval(this._intervalId)}_handleChange(t){t==="add"?this._currentIndex<this._numsLength-1&&(this._currentIndex++,this._onChange(this._currentIndex)):t==="sub"&&this._currentIndex>0&&(this._currentIndex--,this._onChange(this._currentIndex))}}const In=Object.freeze(Object.defineProperty({__proto__:null,Base:{libJsGetDataType:ee,libJsPromiseTimeout:ne},Browser:{libJsColorConsole:fe,libJsIsMobile:et,libJsIsPad:tt,libJsPathParams:nt,libJsSetTitleIcon:it,libJsTagTitleTip:rt,libJsObjToUrlParams:st},Data:{libJsChunkArray:ot,libJsDeepJSONParse:Me,libJsGroupArrayByKey:ut,libJsMatchEmail:ct,libJsShuffleArray:at,libJsStepArray:ft,libReverseArrayFromIndex:lt},File:{libJsDownloadImageLink:ht,libJsImageOptimizer:dt,libJsSaveJson:mt},Formatter:{libJsFormatterByte:$t,libJsMaskPhoneNumber:Mt,libJsNumComma:bt,libJsNumberUnit:gn,libJsSecondsFormatterChinese:vt},Math:{libJsCalculateExpression:wn,libJsConvertAngle:vn,libJsCoordsAngle:$n,libJsCoordsDistance:Mn,libJsDecimal:bn},Misc:{libJsRegFormValidate:Nn,libJsRetryRequest:Sn,libNumerStepper:Cn},Random:{libJsProbabilityResult:Dn,libJsRandom:En,libJsRandomColor:kn,libJsUniqueRandomNumbers:_n},Time:{libJsSameTimeCheck:On,libJsTimeAgo:Tn,libJsTimeGreeting:yn}},Symbol.toStringTag,{value:"Module"}));window.LibJs=In});
|