utils-lib-js 2.0.13 → 2.0.15
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.en.md +95 -82
- package/README.md +13 -0
- package/dist/bundle/base.d.ts +2 -0
- package/dist/bundle/index.d.ts +1 -0
- package/dist/bundle/index.js +3 -3
- package/dist/cjs/base.d.ts +2 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +6 -0
- package/dist/esm/base.d.ts +2 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +6 -1
- package/dist/umd/base.d.ts +2 -0
- package/dist/umd/index.d.ts +1 -0
- package/dist/umd/index.js +6 -0
- package/package.json +50 -50
package/README.en.md
CHANGED
|
@@ -62,9 +62,9 @@ With reference to https://gitee.com/DieHunter/utils-lib-js/blob/master/src/types
|
|
|
62
62
|
|
|
63
63
|
Generates random integers within the specified range.
|
|
64
64
|
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
65
|
+
- `min` : indicates the minimum value (including).
|
|
66
|
+
- `max` : indicates the maximum value (inclusive).
|
|
67
|
+
- `bool` : Indicates whether the maximum value is contained. The default value is false.
|
|
68
68
|
|
|
69
69
|
```javascript
|
|
70
70
|
const randomNumber = randomNum(1, 10);
|
|
@@ -75,7 +75,7 @@ console.log(randomNumber); // Generates a random integer between 1 and 10
|
|
|
75
75
|
|
|
76
76
|
Parses URL query parameters into objects.
|
|
77
77
|
|
|
78
|
-
-
|
|
78
|
+
- `url` : indicates the URL containing the query parameter.
|
|
79
79
|
|
|
80
80
|
```javascript
|
|
81
81
|
const url = "https://example.com/path?param1=value1¶m2=value2";
|
|
@@ -88,8 +88,8 @@ console.log(params);
|
|
|
88
88
|
|
|
89
89
|
Converts the object to a URL query parameter and concatenates it with the original URL.
|
|
90
90
|
|
|
91
|
-
-
|
|
92
|
-
-
|
|
91
|
+
- `url` : indicates the original URL.
|
|
92
|
+
- `query` : object containing query parameters.
|
|
93
93
|
|
|
94
94
|
```javascript
|
|
95
95
|
const url = "https://example.com/path";
|
|
@@ -103,7 +103,7 @@ console.log(newUrl);
|
|
|
103
103
|
|
|
104
104
|
Get the type of data.
|
|
105
105
|
|
|
106
|
-
-
|
|
106
|
+
- `data` : indicates the data to be checked.
|
|
107
107
|
|
|
108
108
|
```javascript
|
|
109
109
|
const dataType = getType("Hello, World!");
|
|
@@ -114,8 +114,8 @@ console.log(dataType); // Output: string
|
|
|
114
114
|
|
|
115
115
|
Check whether the data type is in the whitelist.
|
|
116
116
|
|
|
117
|
-
-
|
|
118
|
-
-
|
|
117
|
+
- `data` : indicates the data to be checked.
|
|
118
|
+
- `whiteList` : indicates the list of allowed data types.
|
|
119
119
|
|
|
120
120
|
```javascript
|
|
121
121
|
const data = 42;
|
|
@@ -124,15 +124,28 @@ const isTypeAllowed = getTypeByList(data, allowedTypes);
|
|
|
124
124
|
console.log(isTypeAllowed); // Output: true
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
+
##### 6. `toKebabCase(camelCase: string, separator: string = "-"): string`
|
|
128
|
+
|
|
129
|
+
The hump name is converted to a hyphenated name
|
|
130
|
+
|
|
131
|
+
- `camelCase` : hump type variable
|
|
132
|
+
- `separator` : indicates the separator
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
const camelCase = "fontSize";
|
|
136
|
+
const kebabCase = toKebabCase(camelCase);
|
|
137
|
+
console.log(kebabCase); // Output: font-size
|
|
138
|
+
```
|
|
139
|
+
|
|
127
140
|
#### object module
|
|
128
141
|
|
|
129
142
|
##### 1. `getValue(object: object, key: string, defaultValue: any = ''): any`
|
|
130
143
|
|
|
131
144
|
Gets the value of the specified path in the object.
|
|
132
145
|
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
146
|
+
- `object` : indicates the target object.
|
|
147
|
+
- `key` : the path to the value to be obtained.
|
|
148
|
+
- `defaultValue` : Default value, returned if the path does not exist.
|
|
136
149
|
|
|
137
150
|
```javascript
|
|
138
151
|
const obj = { a: { b: { c: 42 } } };
|
|
@@ -144,9 +157,9 @@ console.log(value); // Output: 42
|
|
|
144
157
|
|
|
145
158
|
Sets the value of the specified path in the object.
|
|
146
159
|
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
160
|
+
- `object` : indicates the target object.
|
|
161
|
+
- `key` : path to the value to be set.
|
|
162
|
+
- `value` : indicates the value to be set.
|
|
150
163
|
|
|
151
164
|
```javascript
|
|
152
165
|
const obj = { a: { b: { c: 42 } } };
|
|
@@ -158,9 +171,9 @@ console.log(obj); // Output: {a: {b: {c: 42, d: 'new value'}}}
|
|
|
158
171
|
|
|
159
172
|
Mixes the properties of the source object into the target object.
|
|
160
173
|
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
174
|
+
- `target` : indicates the target object.
|
|
175
|
+
- `source` : indicates the source object.
|
|
176
|
+
- `overwrite` : Whether to overwrite an existing attribute. The default is' false '.
|
|
164
177
|
|
|
165
178
|
```javascript
|
|
166
179
|
const target = { a: 1 };
|
|
@@ -173,7 +186,7 @@ console.log(result); // Output: {a: 1, b: 2}
|
|
|
173
186
|
|
|
174
187
|
Inverts the key-value pair of an enumeration object.
|
|
175
188
|
|
|
176
|
-
-
|
|
189
|
+
- `target` : enumeration object to be reversed.
|
|
177
190
|
|
|
178
191
|
```javascript
|
|
179
192
|
const enumObj = { key1: "value1", key2: "value2" };
|
|
@@ -185,8 +198,8 @@ console.log(invertedEnum); // Output: {value1: 'key1', value2: 'key2'}
|
|
|
185
198
|
|
|
186
199
|
Check whether the value is of a non-object type.
|
|
187
200
|
|
|
188
|
-
-
|
|
189
|
-
-
|
|
201
|
+
- `source` : indicates the value to be checked.
|
|
202
|
+
- `type` : indicates the data type.
|
|
190
203
|
|
|
191
204
|
```javascript
|
|
192
205
|
const result = isNotObject(42, "number");
|
|
@@ -197,7 +210,7 @@ console.log(result); // Output: false
|
|
|
197
210
|
|
|
198
211
|
Deep clone object.
|
|
199
212
|
|
|
200
|
-
-
|
|
213
|
+
- `target` : indicates the object to be cloned.
|
|
201
214
|
|
|
202
215
|
```javascript
|
|
203
216
|
const obj = { a: { b: { c: 42 } } };
|
|
@@ -209,8 +222,8 @@ console.log(clonedObj); // Output: {a: {b: {c: 42}}}
|
|
|
209
222
|
|
|
210
223
|
Creates an object of a specific type based on its type.
|
|
211
224
|
|
|
212
|
-
-
|
|
213
|
-
-
|
|
225
|
+
- `type` : indicates the type of the object to be created.
|
|
226
|
+
- `source` : initializes the data of the object.
|
|
214
227
|
|
|
215
228
|
```javascript
|
|
216
229
|
const array = createObjectVariable("array", [1, 2, 3]);
|
|
@@ -221,7 +234,7 @@ console.log(array); // Output: [1, 2, 3]
|
|
|
221
234
|
|
|
222
235
|
Create objects using a prototype chain.
|
|
223
236
|
|
|
224
|
-
-
|
|
237
|
+
- `source` : prototype object.
|
|
225
238
|
|
|
226
239
|
```javascript
|
|
227
240
|
const protoObj = { a: 1 };
|
|
@@ -233,8 +246,8 @@ console.log(newObj.a); // Output: 1
|
|
|
233
246
|
|
|
234
247
|
Inherit the prototype chain.
|
|
235
248
|
|
|
236
|
-
-
|
|
237
|
-
-
|
|
249
|
+
- `source` : prototype chain of the parent object.
|
|
250
|
+
- `target` : constructor of the child object.
|
|
238
251
|
|
|
239
252
|
```javascript
|
|
240
253
|
function Parent() {}
|
|
@@ -252,9 +265,9 @@ childInstance.method(); // Output: Hello from parent
|
|
|
252
265
|
|
|
253
266
|
Gets a singleton instance of a class.
|
|
254
267
|
|
|
255
|
-
-
|
|
256
|
-
-
|
|
257
|
-
-
|
|
268
|
+
- `classProto` : The prototype chain of the class.
|
|
269
|
+
- `overwrite` : Whether to overwrite an existing instance. The default is' false '.
|
|
270
|
+
- `params` : arguments to the class constructor.
|
|
258
271
|
|
|
259
272
|
```javascript
|
|
260
273
|
class Singleton {
|
|
@@ -273,7 +286,7 @@ console.log(instance1 === instance2); // Output: false
|
|
|
273
286
|
|
|
274
287
|
Add a decorator to the class.
|
|
275
288
|
|
|
276
|
-
-
|
|
289
|
+
- `params` : properties and methods to add.
|
|
277
290
|
|
|
278
291
|
```javascript
|
|
279
292
|
@classDecorator({
|
|
@@ -291,7 +304,7 @@ instance.additionalMethod(); // Output: Additional method
|
|
|
291
304
|
|
|
292
305
|
Converts a JSON string to an object.
|
|
293
306
|
|
|
294
|
-
-
|
|
307
|
+
- `target` : JSON string to be converted.
|
|
295
308
|
|
|
296
309
|
```javascript
|
|
297
310
|
const jsonString = '{"key": "value"}';
|
|
@@ -303,7 +316,7 @@ console.log(jsonObject); // Output: {key: 'value'}
|
|
|
303
316
|
|
|
304
317
|
Converts the object to a JSON string.
|
|
305
318
|
|
|
306
|
-
-
|
|
319
|
+
- `target` : indicates the object to be converted.
|
|
307
320
|
|
|
308
321
|
```javascript
|
|
309
322
|
const obj = { key: "value" };
|
|
@@ -315,7 +328,7 @@ console.log(jsonString); // Output: '{"key":"value"}'
|
|
|
315
328
|
|
|
316
329
|
Check whether it is a browser window.
|
|
317
330
|
|
|
318
|
-
-
|
|
331
|
+
- `win` : indicates the object to be checked.
|
|
319
332
|
|
|
320
333
|
```javascript
|
|
321
334
|
const isBrowserWindow = isWindow(window);
|
|
@@ -326,7 +339,7 @@ console.log(isBrowserWindow); // Output: true
|
|
|
326
339
|
|
|
327
340
|
Creates an object whose prototype is empty.
|
|
328
341
|
|
|
329
|
-
-
|
|
342
|
+
- `init` : initializes the object.
|
|
330
343
|
|
|
331
344
|
```javascript
|
|
332
345
|
const o = emptyObject({ name: "hunter" });
|
|
@@ -340,7 +353,7 @@ console.log(o.__proto__, o2.__proto__); // Output: undefined, [Object: null prot
|
|
|
340
353
|
|
|
341
354
|
Randomly sort the array.
|
|
342
355
|
|
|
343
|
-
-
|
|
356
|
+
- `arr` : array to sort.
|
|
344
357
|
|
|
345
358
|
```javascript
|
|
346
359
|
const originalArray = [1, 2, 3, 4, 5];
|
|
@@ -353,7 +366,7 @@ console.log(randomizedArray);
|
|
|
353
366
|
|
|
354
367
|
Removes duplicate elements from the array.
|
|
355
368
|
|
|
356
|
-
-
|
|
369
|
+
- `arr` : array to process.
|
|
357
370
|
|
|
358
371
|
```javascript
|
|
359
372
|
const arrayWithDuplicates = [1, 2, 2, 3, 4, 4, 5];
|
|
@@ -366,8 +379,8 @@ console.log(uniqueArray);
|
|
|
366
379
|
|
|
367
380
|
Reduces the dimension of multiple nested arrays.
|
|
368
381
|
|
|
369
|
-
-
|
|
370
|
-
-
|
|
382
|
+
- `arr` : array to be reduced.
|
|
383
|
+
- `result` : The array used to store the result. The default is an empty array.
|
|
371
384
|
|
|
372
385
|
```javascript
|
|
373
386
|
const nestedArray = [1, [2, [3, [4]], 5]];
|
|
@@ -382,8 +395,8 @@ console.log(demotedArray);
|
|
|
382
395
|
|
|
383
396
|
Limits how often a function is called within a specified period of time.
|
|
384
397
|
|
|
385
|
-
-
|
|
386
|
-
-
|
|
398
|
+
- `fn` : function to be executed.
|
|
399
|
+
- `time` : indicates the time interval (milliseconds).
|
|
387
400
|
|
|
388
401
|
```javascript
|
|
389
402
|
const throttledFunction = throttle(
|
|
@@ -397,8 +410,8 @@ throttledFunction(); // This command is executed only after 1 second
|
|
|
397
410
|
|
|
398
411
|
Limits the continuous invocation of a function for a specified period of time.
|
|
399
412
|
|
|
400
|
-
-
|
|
401
|
-
-
|
|
413
|
+
- `fn` : function to be executed.
|
|
414
|
+
- `time` : indicates the time interval (milliseconds).
|
|
402
415
|
|
|
403
416
|
```javascript
|
|
404
417
|
const debouncedFunction = debounce(
|
|
@@ -412,7 +425,7 @@ debouncedFunction(); // Called multiple times within 1 second, only the last tim
|
|
|
412
425
|
|
|
413
426
|
Create a flat Promise delay object that can be set to time out after a certain amount of time.
|
|
414
427
|
|
|
415
|
-
-
|
|
428
|
+
- `timer` : indicates the timeout period (milliseconds). The default value is 0.
|
|
416
429
|
|
|
417
430
|
```javascript
|
|
418
431
|
const deferFn = () => {
|
|
@@ -432,7 +445,7 @@ delayFn().catch(console.error); // Timeout output
|
|
|
432
445
|
|
|
433
446
|
Catches an Error for an asynchronous operation and returns' [Error, null] 'or' [null, result] '.
|
|
434
447
|
|
|
435
|
-
-
|
|
448
|
+
- `defer` : The Promise object for the asynchronous operation.
|
|
436
449
|
|
|
437
450
|
```javascript
|
|
438
451
|
const asyncOperation = new Promise((resolve, reject) => {
|
|
@@ -471,10 +484,10 @@ clear(); // Cancel the execution
|
|
|
471
484
|
|
|
472
485
|
Creates and returns an HTML element.
|
|
473
486
|
|
|
474
|
-
-
|
|
475
|
-
-
|
|
476
|
-
-
|
|
477
|
-
-
|
|
487
|
+
- `ele` : element type or existing HTMLElement object, optional, default is 'div'.
|
|
488
|
+
- `style` : The style object of the element, optional.
|
|
489
|
+
- `attr` : attribute object of the element, optional.
|
|
490
|
+
- `parent` : indicates the parent of the element. This parameter is optional.
|
|
478
491
|
|
|
479
492
|
```javascript
|
|
480
493
|
const options = {
|
|
@@ -494,9 +507,9 @@ const createdElement = createElement(options);
|
|
|
494
507
|
|
|
495
508
|
Add event listeners to the element.
|
|
496
509
|
|
|
497
|
-
-
|
|
498
|
-
-
|
|
499
|
-
-
|
|
510
|
+
- `ele` : target element.
|
|
511
|
+
- `type` : indicates the type of the event.
|
|
512
|
+
- `handler` : event handler.
|
|
500
513
|
|
|
501
514
|
```javascript
|
|
502
515
|
const button = document.getElementById("myButton");
|
|
@@ -508,7 +521,7 @@ addHandler(button, "click", handleClick);
|
|
|
508
521
|
|
|
509
522
|
Prevent events from bubbling.
|
|
510
523
|
|
|
511
|
-
-
|
|
524
|
+
- `event` : indicates an event object.
|
|
512
525
|
|
|
513
526
|
```javascript
|
|
514
527
|
const handleClick = (event) => {
|
|
@@ -521,7 +534,7 @@ const handleClick = (event) => {
|
|
|
521
534
|
|
|
522
535
|
Default behavior to block events.
|
|
523
536
|
|
|
524
|
-
-
|
|
537
|
+
- `event` : indicates an event object.
|
|
525
538
|
|
|
526
539
|
```javascript
|
|
527
540
|
const handleFormSubmit = (event) => {
|
|
@@ -534,9 +547,9 @@ const handleFormSubmit = (event) => {
|
|
|
534
547
|
|
|
535
548
|
Removes an element's event listener.
|
|
536
549
|
|
|
537
|
-
-
|
|
538
|
-
-
|
|
539
|
-
-
|
|
550
|
+
- `ele` : target element.
|
|
551
|
+
- `type` : indicates the type of the event.
|
|
552
|
+
- `handler` : event handler to be removed.
|
|
540
553
|
|
|
541
554
|
```javascript
|
|
542
555
|
const button = document.getElementById("myButton");
|
|
@@ -550,8 +563,8 @@ removeHandler(button, "click", handleClick);
|
|
|
550
563
|
|
|
551
564
|
Trigger a custom event.
|
|
552
565
|
|
|
553
|
-
-
|
|
554
|
-
-
|
|
566
|
+
- `ele` : target element.
|
|
567
|
+
- `data` : indicates the data of a custom event.
|
|
555
568
|
|
|
556
569
|
```javascript
|
|
557
570
|
const customEvent = new CustomEvent("customEvent", {
|
|
@@ -567,8 +580,8 @@ dispatchEvent(targetElement, customEvent);
|
|
|
567
580
|
|
|
568
581
|
Store values to local storage.
|
|
569
582
|
|
|
570
|
-
-
|
|
571
|
-
-
|
|
583
|
+
- `key` : specifies the name of the key.
|
|
584
|
+
- `val` : The value to be stored.
|
|
572
585
|
|
|
573
586
|
```javascript
|
|
574
587
|
const userData = { username: "john_doe", email: "john@example.com" };
|
|
@@ -579,7 +592,7 @@ setStorage("user_data", userData);
|
|
|
579
592
|
|
|
580
593
|
Gets the value from local storage.
|
|
581
594
|
|
|
582
|
-
-
|
|
595
|
+
- `key` : specifies the key name to be obtained.
|
|
583
596
|
|
|
584
597
|
```javascript
|
|
585
598
|
const storedUserData = getStorage("user_data");
|
|
@@ -591,7 +604,7 @@ console.log(storedUserData);
|
|
|
591
604
|
|
|
592
605
|
Clear the value from the local store.
|
|
593
606
|
|
|
594
|
-
-
|
|
607
|
+
- `key` : specifies the name of the key to be cleared. If no key name is provided, all storage is cleared.
|
|
595
608
|
|
|
596
609
|
```javascript
|
|
597
610
|
clearStorage("user_data"); // Clear the stored value for a specific key name
|
|
@@ -605,9 +618,9 @@ clearStorage(); // Clear all locally stored values
|
|
|
605
618
|
|
|
606
619
|
Output logs in one line.
|
|
607
620
|
|
|
608
|
-
-
|
|
609
|
-
-
|
|
610
|
-
-
|
|
621
|
+
- `str` : The string to be output.
|
|
622
|
+
- `overwrite` : Whether to overwrite the current line. The default is' false '.
|
|
623
|
+
- `wrap` : Whether to wrap lines after output, defaults to 'true'.
|
|
611
624
|
|
|
612
625
|
```javascript
|
|
613
626
|
logOneLine("This is a single line log message.");
|
|
@@ -617,11 +630,11 @@ logOneLine("This is a single line log message.");
|
|
|
617
630
|
|
|
618
631
|
Output a loop animation in the console.
|
|
619
632
|
|
|
620
|
-
-
|
|
633
|
+
- `opts` : an optional parameter object containing the following properties:
|
|
621
634
|
- `loopList` : animation character list, the default is `[' \ \ ', '|', '/', '-', '-']`.
|
|
622
|
-
-
|
|
623
|
-
-
|
|
624
|
-
-
|
|
635
|
+
- `isStop` : Whether to stop the loop. The default is' false '.
|
|
636
|
+
- `timer` : Animation switch interval (milliseconds), default is' 100 '.
|
|
637
|
+
- `index` : indicates the index of the current animated character. The default value is 0.
|
|
625
638
|
|
|
626
639
|
```javascript
|
|
627
640
|
logLoop(); // Start the default loop animation
|
|
@@ -636,7 +649,7 @@ logLoop({ loopList: ["-", "+", "-", "+"], timer: 200 }); // Start a custom loop
|
|
|
636
649
|
A class that provides frame animation.
|
|
637
650
|
|
|
638
651
|
- `start(duration? : number): void ': Starts frame animation, optional parameter' duration 'is frame number control.
|
|
639
|
-
-
|
|
652
|
+
- `stop(): void` : stops frame animation.
|
|
640
653
|
|
|
641
654
|
```javascript
|
|
642
655
|
const animateFrame = new AnimateFrame((timestamp) => {
|
|
@@ -653,9 +666,9 @@ animateFrame.stop(); // Stop frame animation
|
|
|
653
666
|
|
|
654
667
|
Calculate the coordinates of points on the quadratic Bessel curve.
|
|
655
668
|
|
|
656
|
-
-
|
|
657
|
-
-
|
|
658
|
-
-
|
|
669
|
+
- `\_x` : x coordinates of control point 1.
|
|
670
|
+
- `\_y` : y coordinate of control point 1.
|
|
671
|
+
- `t` : indicates the time parameter. The value ranges from 0 to 1.
|
|
659
672
|
|
|
660
673
|
```javascript
|
|
661
674
|
const result = quadraticBezier(0, 0, 1, 1, 0.5);
|
|
@@ -667,11 +680,11 @@ console.log(result);
|
|
|
667
680
|
|
|
668
681
|
Calculate the coordinates of points on a cubic Bezier curve.
|
|
669
682
|
|
|
670
|
-
-
|
|
671
|
-
-
|
|
672
|
-
-
|
|
673
|
-
-
|
|
674
|
-
-
|
|
683
|
+
- `\_x1` : x coordinate of control point 1.
|
|
684
|
+
- `\_y1` : y coordinate of control point 1.
|
|
685
|
+
- `\_x2` : control point 2 x coordinates.
|
|
686
|
+
- `\_y2` : y coordinate of control point 2.
|
|
687
|
+
- `t` : indicates the time parameter. The value ranges from 0 to 1.
|
|
675
688
|
|
|
676
689
|
```javascript
|
|
677
690
|
const result = cubicBezier(0, 0, 0.5, 1, 0.5);
|
|
@@ -696,7 +709,7 @@ console.log(result);
|
|
|
696
709
|
Calculate the number of combinations.
|
|
697
710
|
|
|
698
711
|
- n: indicates the total number.
|
|
699
|
-
-
|
|
712
|
+
- `k` : indicates the number of selected items.
|
|
700
713
|
|
|
701
714
|
```javascript
|
|
702
715
|
const result = combination(5, 2);
|
|
@@ -708,8 +721,8 @@ console.log(result);
|
|
|
708
721
|
|
|
709
722
|
Calculate the point coordinates on the NTH Bezier curve.
|
|
710
723
|
|
|
711
|
-
-
|
|
712
|
-
-
|
|
724
|
+
- `points` : array of control points. Each point is a second-order array.
|
|
725
|
+
- `t` : indicates the time parameter. The value ranges from 0 to 1.
|
|
713
726
|
|
|
714
727
|
```javascript
|
|
715
728
|
const points = [
|
package/README.md
CHANGED
|
@@ -124,6 +124,19 @@ const isTypeAllowed = getTypeByList(data, allowedTypes);
|
|
|
124
124
|
console.log(isTypeAllowed); // 输出: true
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
+
##### 6. `toKebabCase(camelCase: string, separator: string = "-"): string`
|
|
128
|
+
|
|
129
|
+
驼峰式命名转换为连字符式命名
|
|
130
|
+
|
|
131
|
+
- `camelCase`: 驼峰式变量
|
|
132
|
+
- `separator`: 分隔符
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
const camelCase = 'fontSize';
|
|
136
|
+
const kebabCase = toKebabCase(camelCase);
|
|
137
|
+
console.log(kebabCase); // 输出: font-size
|
|
138
|
+
```
|
|
139
|
+
|
|
127
140
|
#### object 模块
|
|
128
141
|
|
|
129
142
|
##### 1. `getValue(object: object, key: string, defaultValue: any = ''): any`
|
package/dist/bundle/base.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ export declare const urlSplit: IUrlSplit;
|
|
|
5
5
|
export declare const urlJoin: IUrlJoin;
|
|
6
6
|
export declare const getType: IGetType<types>;
|
|
7
7
|
export declare const getTypeByList: IGetTypeByList;
|
|
8
|
+
export declare const toKebabCase: (camelCase: string, separator?: string) => string;
|
|
8
9
|
declare const _default: {
|
|
9
10
|
randomNum: IRandomNum;
|
|
10
11
|
urlSplit: IUrlSplit;
|
|
11
12
|
urlJoin: IUrlJoin;
|
|
12
13
|
getType: IGetType<types>;
|
|
13
14
|
getTypeByList: IGetTypeByList;
|
|
15
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
14
16
|
};
|
|
15
17
|
export default _default;
|
package/dist/bundle/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare const _default: {
|
|
|
52
52
|
urlJoin: import("./types").IUrlJoin;
|
|
53
53
|
getType: import("./types").IGetType<import("./static").types>;
|
|
54
54
|
getTypeByList: import("./types").IGetTypeByList;
|
|
55
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
55
56
|
getValue: import("./types").IGetValue;
|
|
56
57
|
setValue: import("./types").ISetValue;
|
|
57
58
|
mixIn: import("./types").IMixIn;
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var UtilsLib=function(e,t,n,r){"use strict";var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}e.types=void 0,function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(e.types||(e.types={}));var u={types:e.types},a=function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},c=function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},s=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},l=function(t){var n=typeof t;if(null===t)return"null";if("object"===n){var r=Object.prototype.toString.call(t);return e.types[r]}return n},f=function(e,t){void 0===t&&(t=[]);var n=l(e);return t.indexOf(n)>0},p={randomNum:a,urlSplit:c,urlJoin:s,getType:l,getTypeByList:f},h=function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},d=function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},v=function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},y=function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},g=function(e,t){return"object"!=typeof e||"null"===t},b=function(e){var t=l(e);if(g(e,t))return e;var n=m(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,b(e))})):"set"===t?e.forEach((function(e){n.add(b(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=b(r)})),n},m=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},w=function(e){function t(){}return t.prototype=e,new t},j=function(e,t){return void 0===t&&(t=function(){}),t.prototype=w(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},E=function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,i([void 0],n,!1)))),e._instance},O=function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},T=function(e){if("string"!==l(e))return null;try{return JSON.parse(e)}catch(e){return null}},S=function(e){if(!f(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},P=function(e){return e&&e===e.window},x=function(e){void 0===e&&(e={});var t=Object.create(null);return Reflect.ownKeys(e).forEach((function(n){return t[n]=e[n]})),t},q={getValue:h,setValue:d,mixIn:v,enumInversion:y,isNotObject:g,cloneDeep:b,createObjectVariable:m,createObject:w,inherit:j,getInstance:E,classDecorator:O,stringToJson:T,jsonToString:S,isWindow:P,emptyObject:x},k=function(e){return e.sort((function(){return Math.random()-.5}))},A=function(e){return Array.from(new Set(e))},H=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===l(e)?H(e,t):t.push(e)})),t},L={arrayRandom:k,arrayUniq:A,arrayDemote:H},M=void 0,C=function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,i([M],r,!1)),n=null}),t))}},D=function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,i([M],r,!1))}),t)}},B=function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},I=function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))},R={throttle:C,debounce:D,defer:B,catchAwait:I},F=function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a},_={createElement:F},N=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},W=function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},J=function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},V=function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},U=function(e,t){var n=new Event(t);e.dispatchEvent(n)},G={addHandler:N,stopBubble:W,stopDefault:J,removeHandler:V,dispatchEvent:U},z=function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},Q=function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},$=function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}},K={setStorage:z,getStorage:Q,clearStorage:$},X=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Y=function(e){return X(e,!0,!1)},Z=["\\","|","/","—","—"],ee=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Z:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Y("\n");s>=l-1&&(s=0);var f=r[s++];return Y(f),setTimeout((function(){e.index=s,ee(e)}),a),e},te={logOneLine:X,logLoop:ee},ne=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function re(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]}function oe(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]}function ie(e){return 0===e||1===e?1:e*ie(e-1)}function ue(e,t){return ie(e)/(ie(t)*ie(e-t))}function ae(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=ue(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}var ce,se={AnimateFrame:ne,quadraticBezier:re,cubicBezier:oe,factorial:ie,combination:ue,NBezier:ae},le=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}(),fe=le.Instance(le),pe=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new le),e},he=function(){return he=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},he.apply(this,arguments)},de=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u},ve=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ye=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},ge=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},be=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=he(he({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return ye(t,void 0,void 0,(function(){var e,t,r,o,i;return ge(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=de([pe,ve("design:paramtypes",[Object])],e)}(),me=function(){return me=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},me.apply(this,arguments)};function we(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(ce||(ce={}));var je={types:ce},Ee=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Oe=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return ce[n]}return t},Te=function(e,t){void 0===t&&(t=[]);var n=Oe(e);return t.indexOf(n)>0},Se={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Ee,getType:Oe,getTypeByList:Te},Pe=function(e,t){return"object"!=typeof e||"null"===t},xe=function(e){var t=Oe(e);if(Pe(e,t))return e;var n=qe(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,xe(e))})):"set"===t?e.forEach((function(e){n.add(xe(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=xe(r)})),n},qe=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},ke=function(e){function t(){}return t.prototype=e,new t},Ae=function(e){if("string"!==Oe(e))return null;try{return JSON.parse(e)}catch(e){return null}},He=function(e){if(!Te(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Le={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Pe,cloneDeep:xe,createObjectVariable:qe,createObject:ke,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=ke(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,we([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Ae,jsonToString:He,isWindow:function(e){return e&&e===e.window}},Me=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Oe(e)?Me(e,t):t.push(e)})),t},Ce={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Me},De=void 0,Be=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},Ie={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,we([De],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,we([De],r,!1))}),t)}},defer:Be,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Re={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Fe={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},_e={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Ne=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},We=function(e){return Ne(e,!0,!1)},Je=["\\","|","/","—","—"],Ve=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Je:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return We("\n");s>=l-1&&(s=0);var f=r[s++];return We(f),setTimeout((function(){e.index=s,Ve(e)}),a),e},Ue={logOneLine:Ne,logLoop:Ve},Ge=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function ze(e){return 0===e||1===e?1:e*ze(e-1)}function Qe(e,t){return ze(e)/(ze(t)*ze(e-t))}var $e={AnimateFrame:Ge,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:ze,combination:Qe,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=Qe(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Ke=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Ke.Instance(Ke);var Xe=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Ke),e},Ye=function(){return Ye=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ye.apply(this,arguments)},Ze=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},et=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},tt=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},nt=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Ye(Ye({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return et(t,void 0,void 0,(function(){var e,t,r,o,i;return tt(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Xe,Ze("design:paramtypes",[Object])],e),e}();me(me(me(me(me(me(me(me(me(me(me({},Le),Se),Ce),Ie),Re),je),Fe),_e),Ue),$e),{eventMessageCenter:Ke,taskQueueLib:nt});
|
|
1
|
+
var UtilsLib=function(e,t,n,r){"use strict";var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}e.types=void 0,function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(e.types||(e.types={}));var u={types:e.types},a=function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},c=function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},s=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},l=function(t){var n=typeof t;if(null===t)return"null";if("object"===n){var r=Object.prototype.toString.call(t);return e.types[r]}return n},f=function(e,t){void 0===t&&(t=[]);var n=l(e);return t.indexOf(n)>0},p=function(e,t){return void 0===t&&(t="-"),e.replace(/[A-Z]/g,(function(e){return"".concat(t).concat(e.toLowerCase())}))},h={randomNum:a,urlSplit:c,urlJoin:s,getType:l,getTypeByList:f,toKebabCase:p},d=function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},v=function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},y=function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},g=function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},b=function(e,t){return"object"!=typeof e||"null"===t},m=function(e){var t=l(e);if(b(e,t))return e;var n=w(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,m(e))})):"set"===t?e.forEach((function(e){n.add(m(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=m(r)})),n},w=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},j=function(e){function t(){}return t.prototype=e,new t},E=function(e,t){return void 0===t&&(t=function(){}),t.prototype=j(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},O=function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,i([void 0],n,!1)))),e._instance},T=function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},S=function(e){if("string"!==l(e))return null;try{return JSON.parse(e)}catch(e){return null}},P=function(e){if(!f(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},x=function(e){return e&&e===e.window},q=function(e){void 0===e&&(e={});var t=Object.create(null);return Reflect.ownKeys(e).forEach((function(n){return t[n]=e[n]})),t},k={getValue:d,setValue:v,mixIn:y,enumInversion:g,isNotObject:b,cloneDeep:m,createObjectVariable:w,createObject:j,inherit:E,getInstance:O,classDecorator:T,stringToJson:S,jsonToString:P,isWindow:x,emptyObject:q},A=function(e){return e.sort((function(){return Math.random()-.5}))},H=function(e){return Array.from(new Set(e))},L=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===l(e)?L(e,t):t.push(e)})),t},C={arrayRandom:A,arrayUniq:H,arrayDemote:L},M=void 0,D=function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,i([M],r,!1)),n=null}),t))}},B=function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,i([M],r,!1))}),t)}},I=function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},R=function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))},F={throttle:D,debounce:B,defer:I,catchAwait:R},_=function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a},N={createElement:_},W=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},J=function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},V=function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},U=function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},G=function(e,t){var n=new Event(t);e.dispatchEvent(n)},z={addHandler:W,stopBubble:J,stopDefault:V,removeHandler:U,dispatchEvent:G},Q=function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},K=function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},$=function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}},Z={setStorage:Q,getStorage:K,clearStorage:$},X=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Y=function(e){return X(e,!0,!1)},ee=["\\","|","/","—","—"],te=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?ee:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Y("\n");s>=l-1&&(s=0);var f=r[s++];return Y(f),setTimeout((function(){e.index=s,te(e)}),a),e},ne={logOneLine:X,logLoop:te},re=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function oe(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]}function ie(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]}function ue(e){return 0===e||1===e?1:e*ue(e-1)}function ae(e,t){return ue(e)/(ue(t)*ue(e-t))}function ce(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=ae(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}var se,le={AnimateFrame:re,quadraticBezier:oe,cubicBezier:ie,factorial:ue,combination:ae,NBezier:ce},fe=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}(),pe=fe.Instance(fe),he=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new fe),e},de=function(){return de=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},de.apply(this,arguments)},ve=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u},ye=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ge=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},be=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},me=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=de(de({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return ge(t,void 0,void 0,(function(){var e,t,r,o,i;return be(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=ve([he,ye("design:paramtypes",[Object])],e)}(),we=function(){return we=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},we.apply(this,arguments)};function je(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(se||(se={}));var Ee={types:se},Oe=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Te=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return se[n]}return t},Se=function(e,t){void 0===t&&(t=[]);var n=Te(e);return t.indexOf(n)>0},Pe={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Oe,getType:Te,getTypeByList:Se},xe=function(e,t){return"object"!=typeof e||"null"===t},qe=function(e){var t=Te(e);if(xe(e,t))return e;var n=ke(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,qe(e))})):"set"===t?e.forEach((function(e){n.add(qe(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=qe(r)})),n},ke=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Ae=function(e){function t(){}return t.prototype=e,new t},He=function(e){if("string"!==Te(e))return null;try{return JSON.parse(e)}catch(e){return null}},Le=function(e){if(!Se(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Ce={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:xe,cloneDeep:qe,createObjectVariable:ke,createObject:Ae,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Ae(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,je([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:He,jsonToString:Le,isWindow:function(e){return e&&e===e.window}},Me=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Te(e)?Me(e,t):t.push(e)})),t},De={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Me},Be=void 0,Ie=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},Re={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,je([Be],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,je([Be],r,!1))}),t)}},defer:Ie,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Fe={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},_e={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Ne={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},We=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Je=function(e){return We(e,!0,!1)},Ve=["\\","|","/","—","—"],Ue=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Ve:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Je("\n");s>=l-1&&(s=0);var f=r[s++];return Je(f),setTimeout((function(){e.index=s,Ue(e)}),a),e},Ge={logOneLine:We,logLoop:Ue},ze=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function Qe(e){return 0===e||1===e?1:e*Qe(e-1)}function Ke(e,t){return Qe(e)/(Qe(t)*Qe(e-t))}var $e={AnimateFrame:ze,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Qe,combination:Ke,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=Ke(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Ze=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Ze.Instance(Ze);var Xe=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Ze),e},Ye=function(){return Ye=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ye.apply(this,arguments)},et=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},tt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},nt=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},rt=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Ye(Ye({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return tt(t,void 0,void 0,(function(){var e,t,r,o,i;return nt(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Xe,et("design:paramtypes",[Object])],e),e}();we(we(we(we(we(we(we(we(we(we(we({},Ce),Pe),De),Re),Fe),Ee),_e),Ne),Ge),$e),{eventMessageCenter:Ze,taskQueueLib:rt});
|
|
2
2
|
/**
|
|
3
3
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
4
4
|
* @copyright 2015 Toru Nagashima. All rights reserved.
|
|
5
5
|
* See LICENSE file in root directory for full license.
|
|
6
6
|
*/
|
|
7
|
-
const rt=new WeakMap,ot=new WeakMap;function it(e){const t=rt.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function ut(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function at(e,t){rt.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,ct(t))}}function ct(e){return{get(){return it(this).event[e]},set(t){it(this).event[e]=t},configurable:!0,enumerable:!0}}function st(e){return{value(){const t=it(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function lt(e){if(null==e||e===Object.prototype)return at;let t=ot.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?st(i):ct(i))}}return r}(lt(Object.getPrototypeOf(e)),e),ot.set(e,t)),t}function ft(e){return it(e).immediateStopped}function pt(e,t){it(e).passiveListener=t}at.prototype={get type(){return it(this).event.type},get target(){return it(this).eventTarget},get currentTarget(){return it(this).currentTarget},composedPath(){const e=it(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return it(this).eventPhase},stopPropagation(){const e=it(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=it(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(it(this).event.bubbles)},get cancelable(){return Boolean(it(this).event.cancelable)},preventDefault(){ut(it(this))},get defaultPrevented(){return it(this).canceled},get composed(){return Boolean(it(this).event.composed)},get timeStamp(){return it(this).timeStamp},get srcElement(){return it(this).eventTarget},get cancelBubble(){return it(this).stopped},set cancelBubble(e){if(!e)return;const t=it(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!it(this).canceled},set returnValue(e){e||ut(it(this))},initEvent(){}},Object.defineProperty(at.prototype,"constructor",{value:at,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(at.prototype,window.Event.prototype),ot.set(window.Event.prototype,at));const ht=new WeakMap,dt=3;function vt(e){return null!==e&&"object"==typeof e}function yt(e){const t=ht.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function gt(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=yt(this).get(e);for(;null!=t;){if(t.listenerType===dt)return t.listener;t=t.next}return null},set(t){"function"==typeof t||vt(t)||(t=null);const n=yt(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===dt?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:dt,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function bt(e){function t(){mt.call(this)}t.prototype=Object.create(mt.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)gt(t.prototype,e[n]);return t}function mt(){if(!(this instanceof mt)){if(1===arguments.length&&Array.isArray(arguments[0]))return bt(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return bt(e)}throw new TypeError("Cannot call a class as a function")}ht.set(this,new Map)}mt.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!vt(t))throw new TypeError("'listener' should be a function or an object.");const r=yt(this),o=vt(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=yt(this),o=(vt(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=yt(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(lt(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,pt(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==dt&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(ft(o))break;r=r.next}return pt(o,null),function(e,t){it(e).eventPhase=t}(o,0),function(e,t){it(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(mt.prototype,"constructor",{value:mt,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(mt.prototype,window.EventTarget.prototype);let wt=class extends mt{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=jt.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};gt(wt.prototype,"abort");const jt=new WeakMap;Object.defineProperties(wt.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(wt.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Et=class{constructor(){Ot.set(this,function(){const e=Object.create(wt.prototype);return mt.call(e),jt.set(e,!1),e}())}get signal(){return Tt(this)}abort(){var e;e=Tt(this),!1===jt.get(e)&&(jt.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Ot=new WeakMap;function Tt(e){const t=Ot.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Et.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Et.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var St=function(e,t){return St=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},St(e,t)};function Pt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}St(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var xt,qt,kt,At,Ht=function(){return Ht=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ht.apply(this,arguments)};function Lt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Mt="undefined"!=typeof AbortController;"undefined"!=typeof window||Mt?xt=globalThis.AbortController:"undefined"!=typeof require?(qt=require("http").request,kt=require("https").request,At=require("url").parse,xt=require("abort-controller")):"object"==typeof globalThis?(qt=t.request,kt=n.request,At=r.parse,xt=Et):xt=function(){throw new Error("AbortController is not defined")};var Ct,Dt=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),Bt=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Ae(e))&&void 0!==t?t:e},blob:function(){return Ae(e)},formData:function(){return Ae(e)},arrayBuffer:function(){return Ae(e)}}},n.origin=null!=t?t:"",n}return Pt(t,e),t}(Dt),It=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new xt:v,g=t.type,b=void 0===g?"json":g,m=Lt(t,["method","query","headers","body","timeout","controller","type"]),w=Ht({url:e,method:u,query:c,headers:l,body:"GET"===u?null:He(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Ee(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=At(r.url,!0);return Ht(Ht({},r),o)},n}return Pt(t,e),t}(Bt),Rt=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=Be(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Lt(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=Be(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?kt:qt)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Ht({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Ht({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Ht({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Ht({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Ht({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Ht({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Ht({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return Pt(t,e),t}(It),Ft=function(){return Ft=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ft.apply(this,arguments)};function _t(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Ct||(Ct={}));var Nt={types:Ct},Wt=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Ct[n]}return t},Jt=function(e,t){void 0===t&&(t=[]);var n=Wt(e);return t.indexOf(n)>0},Vt={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:Wt,getTypeByList:Jt},Ut=function(e,t){return"object"!=typeof e||"null"===t},Gt=function(e){var t=Wt(e);if(Ut(e,t))return e;var n=zt(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,Gt(e))})):"set"===t?e.forEach((function(e){n.add(Gt(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=Gt(r)})),n},zt=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Qt=function(e){function t(){}return t.prototype=e,new t},$t={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Ut,cloneDeep:Gt,createObjectVariable:zt,createObject:Qt,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Qt(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,_t([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==Wt(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!Jt(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window}},Kt=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Wt(e)?Kt(e,t):t.push(e)})),t},Xt={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Kt},Yt=void 0,Zt={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,_t([Yt],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,_t([Yt],r,!1))}),t)}},defer:function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},en={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},tn={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},nn={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},rn=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},on=function(e){return rn(e,!0,!1)},un=["\\","|","/","—","—"],an=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?un:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return on("\n");s>=l-1&&(s=0);var f=r[s++];return on(f),setTimeout((function(){e.index=s,an(e)}),a),e},cn={logOneLine:rn,logLoop:an},sn=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function ln(e){return 0===e||1===e?1:e*ln(e-1)}function fn(e,t){return ln(e)/(ln(t)*ln(e-t))}var pn={AnimateFrame:sn,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:ln,combination:fn,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=fn(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},hn=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();hn.Instance(hn);var dn,vn=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new hn),e},yn=function(){return yn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},yn.apply(this,arguments)},gn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},bn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},mn=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},wn=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=yn(yn({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return bn(t,void 0,void 0,(function(){var e,t,r,o,i;return mn(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([vn,gn("design:paramtypes",[Object])],e),e}(),jn=function(){return jn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},jn.apply(this,arguments)};function En(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(dn||(dn={}));var On={types:dn},Tn=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Sn=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return dn[n]}return t},Pn=function(e,t){void 0===t&&(t=[]);var n=Sn(e);return t.indexOf(n)>0},xn={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Tn,getType:Sn,getTypeByList:Pn},qn=function(e,t){return"object"!=typeof e||"null"===t},kn=function(e){var t=Sn(e);if(qn(e,t))return e;var n=An(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,kn(e))})):"set"===t?e.forEach((function(e){n.add(kn(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=kn(r)})),n},An=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Hn=function(e){function t(){}return t.prototype=e,new t},Ln=function(e){if("string"!==Sn(e))return null;try{return JSON.parse(e)}catch(e){return null}},Mn=function(e){if(!Pn(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Cn={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:qn,cloneDeep:kn,createObjectVariable:An,createObject:Hn,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Hn(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,En([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Ln,jsonToString:Mn,isWindow:function(e){return e&&e===e.window}},Dn=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Sn(e)?Dn(e,t):t.push(e)})),t},Bn={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Dn},In=void 0,Rn=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},Fn={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,En([In],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,En([In],r,!1))}),t)}},defer:Rn,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},_n={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Nn={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Wn={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Jn=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Vn=function(e){return Jn(e,!0,!1)},Un=["\\","|","/","—","—"],Gn=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Un:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Vn("\n");s>=l-1&&(s=0);var f=r[s++];return Vn(f),setTimeout((function(){e.index=s,Gn(e)}),a),e},zn={logOneLine:Jn,logLoop:Gn};function Qn(e){return 0===e||1===e?1:e*Qn(e-1)}function $n(e,t){return Qn(e)/(Qn(t)*Qn(e-t))}var Kn={AnimateFrame:function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}(),quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Qn,combination:$n,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=$n(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Xn=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Xn.Instance(Xn);var Yn=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Xn),e},Zn=function(){return Zn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Zn.apply(this,arguments)},er=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},tr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},nr=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},rr=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Zn(Zn({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return tr(t,void 0,void 0,(function(){var e,t,r,o,i;return nr(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Yn,er("design:paramtypes",[Object])],e),e}();jn(jn(jn(jn(jn(jn(jn(jn(jn(jn(jn({},Cn),xn),Bn),Fn),_n),On),Nn),Wn),zn),Kn),{eventMessageCenter:Xn,taskQueueLib:rr});
|
|
7
|
+
const ot=new WeakMap,it=new WeakMap;function ut(e){const t=ot.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function at(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function ct(e,t){ot.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,st(t))}}function st(e){return{get(){return ut(this).event[e]},set(t){ut(this).event[e]=t},configurable:!0,enumerable:!0}}function lt(e){return{value(){const t=ut(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function ft(e){if(null==e||e===Object.prototype)return ct;let t=it.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?lt(i):st(i))}}return r}(ft(Object.getPrototypeOf(e)),e),it.set(e,t)),t}function pt(e){return ut(e).immediateStopped}function ht(e,t){ut(e).passiveListener=t}ct.prototype={get type(){return ut(this).event.type},get target(){return ut(this).eventTarget},get currentTarget(){return ut(this).currentTarget},composedPath(){const e=ut(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return ut(this).eventPhase},stopPropagation(){const e=ut(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=ut(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(ut(this).event.bubbles)},get cancelable(){return Boolean(ut(this).event.cancelable)},preventDefault(){at(ut(this))},get defaultPrevented(){return ut(this).canceled},get composed(){return Boolean(ut(this).event.composed)},get timeStamp(){return ut(this).timeStamp},get srcElement(){return ut(this).eventTarget},get cancelBubble(){return ut(this).stopped},set cancelBubble(e){if(!e)return;const t=ut(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!ut(this).canceled},set returnValue(e){e||at(ut(this))},initEvent(){}},Object.defineProperty(ct.prototype,"constructor",{value:ct,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(ct.prototype,window.Event.prototype),it.set(window.Event.prototype,ct));const dt=new WeakMap,vt=3;function yt(e){return null!==e&&"object"==typeof e}function gt(e){const t=dt.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function bt(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=gt(this).get(e);for(;null!=t;){if(t.listenerType===vt)return t.listener;t=t.next}return null},set(t){"function"==typeof t||yt(t)||(t=null);const n=gt(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===vt?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:vt,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function mt(e){function t(){wt.call(this)}t.prototype=Object.create(wt.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)bt(t.prototype,e[n]);return t}function wt(){if(!(this instanceof wt)){if(1===arguments.length&&Array.isArray(arguments[0]))return mt(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return mt(e)}throw new TypeError("Cannot call a class as a function")}dt.set(this,new Map)}wt.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!yt(t))throw new TypeError("'listener' should be a function or an object.");const r=gt(this),o=yt(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=gt(this),o=(yt(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=gt(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(ft(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,ht(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==vt&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(pt(o))break;r=r.next}return ht(o,null),function(e,t){ut(e).eventPhase=t}(o,0),function(e,t){ut(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(wt.prototype,"constructor",{value:wt,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(wt.prototype,window.EventTarget.prototype);let jt=class extends wt{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=Et.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};bt(jt.prototype,"abort");const Et=new WeakMap;Object.defineProperties(jt.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(jt.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Ot=class{constructor(){Tt.set(this,function(){const e=Object.create(jt.prototype);return wt.call(e),Et.set(e,!1),e}())}get signal(){return St(this)}abort(){var e;e=St(this),!1===Et.get(e)&&(Et.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Tt=new WeakMap;function St(e){const t=Tt.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Ot.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ot.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var Pt=function(e,t){return Pt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Pt(e,t)};function xt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Pt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var qt,kt,At,Ht,Lt=function(){return Lt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Lt.apply(this,arguments)};function Ct(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Mt="undefined"!=typeof AbortController;"undefined"!=typeof window||Mt?qt=globalThis.AbortController:"undefined"!=typeof require?(kt=require("http").request,At=require("https").request,Ht=require("url").parse,qt=require("abort-controller")):"object"==typeof globalThis?(kt=t.request,At=n.request,Ht=r.parse,qt=Ot):qt=function(){throw new Error("AbortController is not defined")};var Dt,Bt=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),It=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=He(e))&&void 0!==t?t:e},blob:function(){return He(e)},formData:function(){return He(e)},arrayBuffer:function(){return He(e)}}},n.origin=null!=t?t:"",n}return xt(t,e),t}(Bt),Rt=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new qt:v,g=t.type,b=void 0===g?"json":g,m=Ct(t,["method","query","headers","body","timeout","controller","type"]),w=Lt({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Le(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Oe(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=Ht(r.url,!0);return Lt(Lt({},r),o)},n}return xt(t,e),t}(It),Ft=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=Ie(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Ct(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=Ie(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?At:kt)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Lt({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Lt({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Lt({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Lt({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Lt({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Lt({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Lt({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return xt(t,e),t}(Rt),_t=function(){return _t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_t.apply(this,arguments)};function Nt(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Dt||(Dt={}));var Wt={types:Dt},Jt=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Dt[n]}return t},Vt=function(e,t){void 0===t&&(t=[]);var n=Jt(e);return t.indexOf(n)>0},Ut={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:Jt,getTypeByList:Vt},Gt=function(e,t){return"object"!=typeof e||"null"===t},zt=function(e){var t=Jt(e);if(Gt(e,t))return e;var n=Qt(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,zt(e))})):"set"===t?e.forEach((function(e){n.add(zt(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=zt(r)})),n},Qt=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Kt=function(e){function t(){}return t.prototype=e,new t},$t={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Gt,cloneDeep:zt,createObjectVariable:Qt,createObject:Kt,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Kt(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Nt([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==Jt(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!Vt(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window}},Zt=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Jt(e)?Zt(e,t):t.push(e)})),t},Xt={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Zt},Yt=void 0,en={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Nt([Yt],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Nt([Yt],r,!1))}),t)}},defer:function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},tn={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},nn={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},rn={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},on=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},un=function(e){return on(e,!0,!1)},an=["\\","|","/","—","—"],cn=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?an:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return un("\n");s>=l-1&&(s=0);var f=r[s++];return un(f),setTimeout((function(){e.index=s,cn(e)}),a),e},sn={logOneLine:on,logLoop:cn},ln=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function fn(e){return 0===e||1===e?1:e*fn(e-1)}function pn(e,t){return fn(e)/(fn(t)*fn(e-t))}var hn={AnimateFrame:ln,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:fn,combination:pn,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=pn(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},dn=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();dn.Instance(dn);var vn,yn=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new dn),e},gn=function(){return gn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},gn.apply(this,arguments)},bn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},mn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},wn=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},jn=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=gn(gn({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return mn(t,void 0,void 0,(function(){var e,t,r,o,i;return wn(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([yn,bn("design:paramtypes",[Object])],e),e}(),En=function(){return En=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},En.apply(this,arguments)};function On(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(vn||(vn={}));var Tn={types:vn},Sn=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Pn=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return vn[n]}return t},xn=function(e,t){void 0===t&&(t=[]);var n=Pn(e);return t.indexOf(n)>0},qn={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Sn,getType:Pn,getTypeByList:xn},kn=function(e,t){return"object"!=typeof e||"null"===t},An=function(e){var t=Pn(e);if(kn(e,t))return e;var n=Hn(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,An(e))})):"set"===t?e.forEach((function(e){n.add(An(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=An(r)})),n},Hn=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Ln=function(e){function t(){}return t.prototype=e,new t},Cn=function(e){if("string"!==Pn(e))return null;try{return JSON.parse(e)}catch(e){return null}},Mn=function(e){if(!xn(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Dn={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:kn,cloneDeep:An,createObjectVariable:Hn,createObject:Ln,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Ln(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,On([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Cn,jsonToString:Mn,isWindow:function(e){return e&&e===e.window}},Bn=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Pn(e)?Bn(e,t):t.push(e)})),t},In={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Bn},Rn=void 0,Fn=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},_n={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,On([Rn],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,On([Rn],r,!1))}),t)}},defer:Fn,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Nn={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Wn={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Jn={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Vn=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Un=function(e){return Vn(e,!0,!1)},Gn=["\\","|","/","—","—"],zn=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Gn:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Un("\n");s>=l-1&&(s=0);var f=r[s++];return Un(f),setTimeout((function(){e.index=s,zn(e)}),a),e},Qn={logOneLine:Vn,logLoop:zn};function Kn(e){return 0===e||1===e?1:e*Kn(e-1)}function $n(e,t){return Kn(e)/(Kn(t)*Kn(e-t))}var Zn={AnimateFrame:function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}(),quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Kn,combination:$n,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=$n(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Xn=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Xn.Instance(Xn);var Yn=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Xn),e},er=function(){return er=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},er.apply(this,arguments)},tr=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},nr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},rr=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},or=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=er(er({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return nr(t,void 0,void 0,(function(){var e,t,r,o,i;return rr(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Yn,tr("design:paramtypes",[Object])],e),e}();En(En(En(En(En(En(En(En(En(En(En({},Dn),qn),In),_n),Nn),Tn),Wn),Jn),Qn),Zn),{eventMessageCenter:Xn,taskQueueLib:or});
|
|
8
8
|
/**
|
|
9
9
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
10
10
|
* @copyright 2015 Toru Nagashima. All rights reserved.
|
|
11
11
|
* See LICENSE file in root directory for full license.
|
|
12
12
|
*/
|
|
13
|
-
const or=new WeakMap,ir=new WeakMap;function ur(e){const t=or.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function ar(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function cr(e,t){or.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,sr(t))}}function sr(e){return{get(){return ur(this).event[e]},set(t){ur(this).event[e]=t},configurable:!0,enumerable:!0}}function lr(e){return{value(){const t=ur(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function fr(e){if(null==e||e===Object.prototype)return cr;let t=ir.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?lr(i):sr(i))}}return r}(fr(Object.getPrototypeOf(e)),e),ir.set(e,t)),t}function pr(e){return ur(e).immediateStopped}function hr(e,t){ur(e).passiveListener=t}cr.prototype={get type(){return ur(this).event.type},get target(){return ur(this).eventTarget},get currentTarget(){return ur(this).currentTarget},composedPath(){const e=ur(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return ur(this).eventPhase},stopPropagation(){const e=ur(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=ur(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(ur(this).event.bubbles)},get cancelable(){return Boolean(ur(this).event.cancelable)},preventDefault(){ar(ur(this))},get defaultPrevented(){return ur(this).canceled},get composed(){return Boolean(ur(this).event.composed)},get timeStamp(){return ur(this).timeStamp},get srcElement(){return ur(this).eventTarget},get cancelBubble(){return ur(this).stopped},set cancelBubble(e){if(!e)return;const t=ur(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!ur(this).canceled},set returnValue(e){e||ar(ur(this))},initEvent(){}},Object.defineProperty(cr.prototype,"constructor",{value:cr,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(cr.prototype,window.Event.prototype),ir.set(window.Event.prototype,cr));const dr=new WeakMap,vr=3;function yr(e){return null!==e&&"object"==typeof e}function gr(e){const t=dr.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function br(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=gr(this).get(e);for(;null!=t;){if(t.listenerType===vr)return t.listener;t=t.next}return null},set(t){"function"==typeof t||yr(t)||(t=null);const n=gr(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===vr?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:vr,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function mr(e){function t(){wr.call(this)}t.prototype=Object.create(wr.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)br(t.prototype,e[n]);return t}function wr(){if(!(this instanceof wr)){if(1===arguments.length&&Array.isArray(arguments[0]))return mr(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return mr(e)}throw new TypeError("Cannot call a class as a function")}dr.set(this,new Map)}wr.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!yr(t))throw new TypeError("'listener' should be a function or an object.");const r=gr(this),o=yr(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=gr(this),o=(yr(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=gr(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(fr(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,hr(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==vr&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(pr(o))break;r=r.next}return hr(o,null),function(e,t){ur(e).eventPhase=t}(o,0),function(e,t){ur(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(wr.prototype,"constructor",{value:wr,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(wr.prototype,window.EventTarget.prototype);class jr extends wr{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=Er.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}}br(jr.prototype,"abort");const Er=new WeakMap;Object.defineProperties(jr.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(jr.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Or=class{constructor(){Tr.set(this,function(){const e=Object.create(jr.prototype);return wr.call(e),Er.set(e,!1),e}())}get signal(){return Sr(this)}abort(){var e;e=Sr(this),!1===Er.get(e)&&(Er.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Tr=new WeakMap;function Sr(e){const t=Tr.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Or.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Or.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var Pr=function(e,t){return Pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Pr(e,t)};function xr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var qr,kr,Ar,Hr,Lr=function(){return Lr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Lr.apply(this,arguments)};function Mr(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Cr="undefined"!=typeof AbortController;"undefined"!=typeof window||Cr?qr=globalThis.AbortController:"undefined"!=typeof require?(kr=require("http").request,Ar=require("https").request,Hr=require("url").parse,qr=require("abort-controller")):"object"==typeof globalThis?(kr=t.request,Ar=n.request,Hr=r.parse,qr=Or):qr=function(){throw new Error("AbortController is not defined")};var Dr=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Ln(e))&&void 0!==t?t:e},blob:function(){return Ln(e)},formData:function(){return Ln(e)},arrayBuffer:function(){return Ln(e)}}},n.origin=null!=t?t:"",n}return xr(t,e),t}(function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}()),Br=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new qr:v,g=t.type,b=void 0===g?"json":g,m=Mr(t,["method","query","headers","body","timeout","controller","type"]),w=Lr({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Mn(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Tn(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=Hr(r.url,!0);return Lr(Lr({},r),o)},n}return xr(t,e),t}(Dr),Ir=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=Rn(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Mr(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=Rn(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?Ar:kr)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Lr({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Lr({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Lr({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Lr({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Lr({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Lr({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Lr({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return xr(t,e),t}(Br);Ft(Ft(Ft(Ft(Ft(Ft(Ft(Ft(Ft(Ft(Ft({},$t),Vt),Xt),Zt),en),Nt),tn),nn),cn),pn),{eventMessageCenter:hn,taskQueueLib:wn,JSRequest:Ir});var Rr=function(){return Rr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Rr.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var Fr={type:"interval",autoStop:!0},_r=function(){function e(e){var t=this;this.__id=0,this.timers={},this.fixString="#@$&*",this.isFrame=function(){return"frame"===t.opts.type},this.opts=Rr(Rr({},Fr),e)}return e.prototype.add=function(e,t){return this.initDelay(t),this.pushTimer(e,t)},e.prototype.delete=function(e){var t,n=e.id,r=e.delay,o=this.timers;r&&(null===(t=o[r])||void 0===t?void 0:t.handles)&&(o[r].handles=o[r].handles.filter((function(e){return e.id!==n})))},e.prototype.clear=function(){var e=this,t=this.timers;Object.keys(t).forEach((function(n){return e.stopTimer(t[n])})),this.timers={}},e.prototype.pushTimer=function(e,t){var n=this.timers,r={id:this.getId(),handle:e,delay:t};return n[t].handles.push(r),r},e.prototype.initDelay=function(e){var t=this.timers;t[e]||(t[e]={intervalId:null,handles:[],delay:e},this.startTimer(t[e]))},e.prototype.startTimer=function(e){var t=this;e.intervalId=this.delayHandle((function(){t.autoStopTimer(e),e.handles.forEach((function(e){return e.handle()}))}),e.delay)},e.prototype.stopTimer=function(e){var t=e.intervalId;this.isFrame()?t():clearInterval(t)},e.prototype.autoStopTimer=function(e){var t=this.opts.autoStop,n=this.timers,r=e.delay;t&&e.handles.length<=0&&(this.stopTimer(e),n[r]=null)},e.prototype.delayHandle=function(e,t){return this.isFrame()?function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}}(e,t):setInterval(e,t)},e.prototype.getId=function(){return"".concat(this.fixString,"-").concat(++this.__id)},e}(),Nr=o(o(o(o(o(o(o(o(o(o(o({},q),p),L),R),_),u),G),K),te),se),{eventMessageCenter:le,taskQueueLib:be,JSRequest:Rt,TimerManager:_r});return e.AnimateFrame=ne,e.MessageCenter=le,e.NBezier=ae,e.Request=Rt,e.TaskQueue=be,e.TimerManager=_r,e.addHandler=N,e.arrayDemote=H,e.arrayRandom=k,e.arrayUniq=A,e.catchAwait=I,e.classDecorator=O,e.clearStorage=$,e.cloneDeep=b,e.combination=ue,e.createElement=F,e.createObject=w,e.createObjectVariable=m,e.cubicBezier=oe,e.debounce=D,e.decoratorMessageCenter=pe,e.decoratorTaskQueue=function(e){return function(t){t.prototype.taskQueue||(t.prototype.taskQueue=new be(e))}},e.default=Nr,e.defaultOptions=Fr,e.defer=B,e.dispatchEvent=U,e.emptyObject=x,e.enumInversion=y,e.factorial=ie,e.getInstance=E,e.getStorage=Q,e.getType=l,e.getTypeByList=f,e.getValue=h,e.inherit=j,e.isNotObject=g,e.isWindow=P,e.jsonToString=S,e.logLoop=ee,e.logOneLine=X,e.messageCenter=fe,e.mixIn=v,e.quadraticBezier=re,e.randomNum=a,e.removeHandler=V,e.requestFrame=function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}},e.setStorage=z,e.setValue=d,e.stopBubble=W,e.stopDefault=J,e.stringToJson=T,e.throttle=C,e.urlJoin=s,e.urlSplit=c,Object.defineProperty(e,"__esModule",{value:!0}),e}({},http,https,url);
|
|
13
|
+
const ir=new WeakMap,ur=new WeakMap;function ar(e){const t=ir.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function cr(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function sr(e,t){ir.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,lr(t))}}function lr(e){return{get(){return ar(this).event[e]},set(t){ar(this).event[e]=t},configurable:!0,enumerable:!0}}function fr(e){return{value(){const t=ar(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function pr(e){if(null==e||e===Object.prototype)return sr;let t=ur.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?fr(i):lr(i))}}return r}(pr(Object.getPrototypeOf(e)),e),ur.set(e,t)),t}function hr(e){return ar(e).immediateStopped}function dr(e,t){ar(e).passiveListener=t}sr.prototype={get type(){return ar(this).event.type},get target(){return ar(this).eventTarget},get currentTarget(){return ar(this).currentTarget},composedPath(){const e=ar(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return ar(this).eventPhase},stopPropagation(){const e=ar(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=ar(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(ar(this).event.bubbles)},get cancelable(){return Boolean(ar(this).event.cancelable)},preventDefault(){cr(ar(this))},get defaultPrevented(){return ar(this).canceled},get composed(){return Boolean(ar(this).event.composed)},get timeStamp(){return ar(this).timeStamp},get srcElement(){return ar(this).eventTarget},get cancelBubble(){return ar(this).stopped},set cancelBubble(e){if(!e)return;const t=ar(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!ar(this).canceled},set returnValue(e){e||cr(ar(this))},initEvent(){}},Object.defineProperty(sr.prototype,"constructor",{value:sr,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(sr.prototype,window.Event.prototype),ur.set(window.Event.prototype,sr));const vr=new WeakMap,yr=3;function gr(e){return null!==e&&"object"==typeof e}function br(e){const t=vr.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function mr(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=br(this).get(e);for(;null!=t;){if(t.listenerType===yr)return t.listener;t=t.next}return null},set(t){"function"==typeof t||gr(t)||(t=null);const n=br(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===yr?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:yr,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function wr(e){function t(){jr.call(this)}t.prototype=Object.create(jr.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)mr(t.prototype,e[n]);return t}function jr(){if(!(this instanceof jr)){if(1===arguments.length&&Array.isArray(arguments[0]))return wr(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return wr(e)}throw new TypeError("Cannot call a class as a function")}vr.set(this,new Map)}jr.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!gr(t))throw new TypeError("'listener' should be a function or an object.");const r=br(this),o=gr(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=br(this),o=(gr(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=br(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(pr(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,dr(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==yr&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(hr(o))break;r=r.next}return dr(o,null),function(e,t){ar(e).eventPhase=t}(o,0),function(e,t){ar(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(jr.prototype,"constructor",{value:jr,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(jr.prototype,window.EventTarget.prototype);class Er extends jr{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=Or.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}}mr(Er.prototype,"abort");const Or=new WeakMap;Object.defineProperties(Er.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Er.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Tr=class{constructor(){Sr.set(this,function(){const e=Object.create(Er.prototype);return jr.call(e),Or.set(e,!1),e}())}get signal(){return Pr(this)}abort(){var e;e=Pr(this),!1===Or.get(e)&&(Or.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Sr=new WeakMap;function Pr(e){const t=Sr.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Tr.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Tr.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var xr=function(e,t){return xr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},xr(e,t)};function qr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}xr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var kr,Ar,Hr,Lr,Cr=function(){return Cr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Cr.apply(this,arguments)};function Mr(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Dr="undefined"!=typeof AbortController;"undefined"!=typeof window||Dr?kr=globalThis.AbortController:"undefined"!=typeof require?(Ar=require("http").request,Hr=require("https").request,Lr=require("url").parse,kr=require("abort-controller")):"object"==typeof globalThis?(Ar=t.request,Hr=n.request,Lr=r.parse,kr=Tr):kr=function(){throw new Error("AbortController is not defined")};var Br=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Cn(e))&&void 0!==t?t:e},blob:function(){return Cn(e)},formData:function(){return Cn(e)},arrayBuffer:function(){return Cn(e)}}},n.origin=null!=t?t:"",n}return qr(t,e),t}(function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}()),Ir=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new kr:v,g=t.type,b=void 0===g?"json":g,m=Mr(t,["method","query","headers","body","timeout","controller","type"]),w=Cr({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Mn(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Sn(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=Lr(r.url,!0);return Cr(Cr({},r),o)},n}return qr(t,e),t}(Br),Rr=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=Fn(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Mr(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=Fn(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?Hr:Ar)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Cr({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Cr({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Cr({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Cr({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Cr({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Cr({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Cr({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return qr(t,e),t}(Ir);_t(_t(_t(_t(_t(_t(_t(_t(_t(_t(_t({},$t),Ut),Xt),en),tn),Wt),nn),rn),sn),hn),{eventMessageCenter:dn,taskQueueLib:jn,JSRequest:Rr});var Fr=function(){return Fr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fr.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var _r={type:"interval",autoStop:!0},Nr=function(){function e(e){var t=this;this.__id=0,this.timers={},this.fixString="#@$&*",this.isFrame=function(){return"frame"===t.opts.type},this.opts=Fr(Fr({},_r),e)}return e.prototype.add=function(e,t){return this.initDelay(t),this.pushTimer(e,t)},e.prototype.delete=function(e){var t,n=e.id,r=e.delay,o=this.timers;r&&(null===(t=o[r])||void 0===t?void 0:t.handles)&&(o[r].handles=o[r].handles.filter((function(e){return e.id!==n})))},e.prototype.clear=function(){var e=this,t=this.timers;Object.keys(t).forEach((function(n){return e.stopTimer(t[n])})),this.timers={}},e.prototype.pushTimer=function(e,t){var n=this.timers,r={id:this.getId(),handle:e,delay:t};return n[t].handles.push(r),r},e.prototype.initDelay=function(e){var t=this.timers;t[e]||(t[e]={intervalId:null,handles:[],delay:e},this.startTimer(t[e]))},e.prototype.startTimer=function(e){var t=this;e.intervalId=this.delayHandle((function(){t.autoStopTimer(e),e.handles.forEach((function(e){return e.handle()}))}),e.delay)},e.prototype.stopTimer=function(e){var t=e.intervalId;this.isFrame()?t():clearInterval(t)},e.prototype.autoStopTimer=function(e){var t=this.opts.autoStop,n=this.timers,r=e.delay;t&&e.handles.length<=0&&(this.stopTimer(e),n[r]=null)},e.prototype.delayHandle=function(e,t){return this.isFrame()?function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}}(e,t):setInterval(e,t)},e.prototype.getId=function(){return"".concat(this.fixString,"-").concat(++this.__id)},e}(),Wr=o(o(o(o(o(o(o(o(o(o(o({},k),h),C),F),N),u),z),Z),ne),le),{eventMessageCenter:fe,taskQueueLib:me,JSRequest:Ft,TimerManager:Nr});return e.AnimateFrame=re,e.MessageCenter=fe,e.NBezier=ce,e.Request=Ft,e.TaskQueue=me,e.TimerManager=Nr,e.addHandler=W,e.arrayDemote=L,e.arrayRandom=A,e.arrayUniq=H,e.catchAwait=R,e.classDecorator=T,e.clearStorage=$,e.cloneDeep=m,e.combination=ae,e.createElement=_,e.createObject=j,e.createObjectVariable=w,e.cubicBezier=ie,e.debounce=B,e.decoratorMessageCenter=he,e.decoratorTaskQueue=function(e){return function(t){t.prototype.taskQueue||(t.prototype.taskQueue=new me(e))}},e.default=Wr,e.defaultOptions=_r,e.defer=I,e.dispatchEvent=G,e.emptyObject=q,e.enumInversion=g,e.factorial=ue,e.getInstance=O,e.getStorage=K,e.getType=l,e.getTypeByList=f,e.getValue=d,e.inherit=E,e.isNotObject=b,e.isWindow=x,e.jsonToString=P,e.logLoop=te,e.logOneLine=X,e.messageCenter=pe,e.mixIn=y,e.quadraticBezier=oe,e.randomNum=a,e.removeHandler=U,e.requestFrame=function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}},e.setStorage=Q,e.setValue=v,e.stopBubble=J,e.stopDefault=V,e.stringToJson=S,e.throttle=D,e.toKebabCase=p,e.urlJoin=s,e.urlSplit=c,Object.defineProperty(e,"__esModule",{value:!0}),e}({},http,https,url);
|
package/dist/cjs/base.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ export declare const urlSplit: IUrlSplit;
|
|
|
5
5
|
export declare const urlJoin: IUrlJoin;
|
|
6
6
|
export declare const getType: IGetType<types>;
|
|
7
7
|
export declare const getTypeByList: IGetTypeByList;
|
|
8
|
+
export declare const toKebabCase: (camelCase: string, separator?: string) => string;
|
|
8
9
|
declare const _default: {
|
|
9
10
|
randomNum: IRandomNum;
|
|
10
11
|
urlSplit: IUrlSplit;
|
|
11
12
|
urlJoin: IUrlJoin;
|
|
12
13
|
getType: IGetType<types>;
|
|
13
14
|
getTypeByList: IGetTypeByList;
|
|
15
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
14
16
|
};
|
|
15
17
|
export default _default;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare const _default: {
|
|
|
52
52
|
urlJoin: import("./types").IUrlJoin;
|
|
53
53
|
getType: import("./types").IGetType<import("./static").types>;
|
|
54
54
|
getTypeByList: import("./types").IGetTypeByList;
|
|
55
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
55
56
|
getValue: import("./types").IGetValue;
|
|
56
57
|
setValue: import("./types").ISetValue;
|
|
57
58
|
mixIn: import("./types").IMixIn;
|
package/dist/cjs/index.js
CHANGED
|
@@ -97,12 +97,17 @@ var getTypeByList$3 = function (data, whiteList) {
|
|
|
97
97
|
var __type = getType$3(data);
|
|
98
98
|
return whiteList.indexOf(__type) > 0;
|
|
99
99
|
};
|
|
100
|
+
var toKebabCase = function (camelCase, separator) {
|
|
101
|
+
if (separator === void 0) { separator = "-"; }
|
|
102
|
+
return camelCase.replace(/[A-Z]/g, function (m) { return "".concat(separator).concat(m.toLowerCase()); });
|
|
103
|
+
};
|
|
100
104
|
var base$3 = {
|
|
101
105
|
randomNum: randomNum$3,
|
|
102
106
|
urlSplit: urlSplit$3,
|
|
103
107
|
urlJoin: urlJoin$3,
|
|
104
108
|
getType: getType$3,
|
|
105
109
|
getTypeByList: getTypeByList$3,
|
|
110
|
+
toKebabCase: toKebabCase,
|
|
106
111
|
};
|
|
107
112
|
|
|
108
113
|
var getValue$3 = function (object, key, defaultValue) {
|
|
@@ -6153,5 +6158,6 @@ exports.stopBubble = stopBubble$3;
|
|
|
6153
6158
|
exports.stopDefault = stopDefault$3;
|
|
6154
6159
|
exports.stringToJson = stringToJson$3;
|
|
6155
6160
|
exports.throttle = throttle$3;
|
|
6161
|
+
exports.toKebabCase = toKebabCase;
|
|
6156
6162
|
exports.urlJoin = urlJoin$3;
|
|
6157
6163
|
exports.urlSplit = urlSplit$3;
|
package/dist/esm/base.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ export declare const urlSplit: IUrlSplit;
|
|
|
5
5
|
export declare const urlJoin: IUrlJoin;
|
|
6
6
|
export declare const getType: IGetType<types>;
|
|
7
7
|
export declare const getTypeByList: IGetTypeByList;
|
|
8
|
+
export declare const toKebabCase: (camelCase: string, separator?: string) => string;
|
|
8
9
|
declare const _default: {
|
|
9
10
|
randomNum: IRandomNum;
|
|
10
11
|
urlSplit: IUrlSplit;
|
|
11
12
|
urlJoin: IUrlJoin;
|
|
12
13
|
getType: IGetType<types>;
|
|
13
14
|
getTypeByList: IGetTypeByList;
|
|
15
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
14
16
|
};
|
|
15
17
|
export default _default;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare const _default: {
|
|
|
52
52
|
urlJoin: import("./types").IUrlJoin;
|
|
53
53
|
getType: import("./types").IGetType<import("./static").types>;
|
|
54
54
|
getTypeByList: import("./types").IGetTypeByList;
|
|
55
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
55
56
|
getValue: import("./types").IGetValue;
|
|
56
57
|
setValue: import("./types").ISetValue;
|
|
57
58
|
mixIn: import("./types").IMixIn;
|
package/dist/esm/index.js
CHANGED
|
@@ -93,12 +93,17 @@ var getTypeByList$3 = function (data, whiteList) {
|
|
|
93
93
|
var __type = getType$3(data);
|
|
94
94
|
return whiteList.indexOf(__type) > 0;
|
|
95
95
|
};
|
|
96
|
+
var toKebabCase = function (camelCase, separator) {
|
|
97
|
+
if (separator === void 0) { separator = "-"; }
|
|
98
|
+
return camelCase.replace(/[A-Z]/g, function (m) { return "".concat(separator).concat(m.toLowerCase()); });
|
|
99
|
+
};
|
|
96
100
|
var base$3 = {
|
|
97
101
|
randomNum: randomNum$3,
|
|
98
102
|
urlSplit: urlSplit$3,
|
|
99
103
|
urlJoin: urlJoin$3,
|
|
100
104
|
getType: getType$3,
|
|
101
105
|
getTypeByList: getTypeByList$3,
|
|
106
|
+
toKebabCase: toKebabCase,
|
|
102
107
|
};
|
|
103
108
|
|
|
104
109
|
var getValue$3 = function (object, key, defaultValue) {
|
|
@@ -6097,4 +6102,4 @@ var TimerManager = (function () {
|
|
|
6097
6102
|
|
|
6098
6103
|
var index = __assign$9(__assign$9(__assign$9(__assign$9(__assign$9(__assign$9(__assign$9(__assign$9(__assign$9(__assign$9(__assign$9({}, object$3), base$3), array$3), __function$3), element$3), __static$3), event$3), storage$3), log$3), animate$3), { eventMessageCenter: MessageCenter$3, taskQueueLib: TaskQueue$3, JSRequest: Request$1, TimerManager: TimerManager });
|
|
6099
6104
|
|
|
6100
|
-
export { AnimateFrame$3 as AnimateFrame, MessageCenter$3 as MessageCenter, NBezier$3 as NBezier, Request$1 as Request, TaskQueue$3 as TaskQueue, TimerManager, addHandler$3 as addHandler, arrayDemote$3 as arrayDemote, arrayRandom$3 as arrayRandom, arrayUniq$3 as arrayUniq, catchAwait$3 as catchAwait, classDecorator$3 as classDecorator, clearStorage$3 as clearStorage, cloneDeep$3 as cloneDeep, combination$3 as combination, createElement$3 as createElement, createObject$3 as createObject, createObjectVariable$3 as createObjectVariable, cubicBezier$3 as cubicBezier, debounce$3 as debounce, decoratorMessageCenter$3 as decoratorMessageCenter, decoratorTaskQueue, index as default, defaultOptions, defer$3 as defer, dispatchEvent$3 as dispatchEvent, emptyObject, enumInversion$3 as enumInversion, factorial$3 as factorial, getInstance$3 as getInstance, getStorage$3 as getStorage, getType$3 as getType, getTypeByList$3 as getTypeByList, getValue$3 as getValue, inherit$3 as inherit, isNotObject$3 as isNotObject, isWindow$3 as isWindow, jsonToString$3 as jsonToString, logLoop$3 as logLoop, logOneLine$3 as logOneLine, messageCenter, mixIn$3 as mixIn, quadraticBezier$3 as quadraticBezier, randomNum$3 as randomNum, removeHandler$3 as removeHandler, requestFrame$1 as requestFrame, setStorage$3 as setStorage, setValue$3 as setValue, stopBubble$3 as stopBubble, stopDefault$3 as stopDefault, stringToJson$3 as stringToJson, throttle$3 as throttle, types$3 as types, urlJoin$3 as urlJoin, urlSplit$3 as urlSplit };
|
|
6105
|
+
export { AnimateFrame$3 as AnimateFrame, MessageCenter$3 as MessageCenter, NBezier$3 as NBezier, Request$1 as Request, TaskQueue$3 as TaskQueue, TimerManager, addHandler$3 as addHandler, arrayDemote$3 as arrayDemote, arrayRandom$3 as arrayRandom, arrayUniq$3 as arrayUniq, catchAwait$3 as catchAwait, classDecorator$3 as classDecorator, clearStorage$3 as clearStorage, cloneDeep$3 as cloneDeep, combination$3 as combination, createElement$3 as createElement, createObject$3 as createObject, createObjectVariable$3 as createObjectVariable, cubicBezier$3 as cubicBezier, debounce$3 as debounce, decoratorMessageCenter$3 as decoratorMessageCenter, decoratorTaskQueue, index as default, defaultOptions, defer$3 as defer, dispatchEvent$3 as dispatchEvent, emptyObject, enumInversion$3 as enumInversion, factorial$3 as factorial, getInstance$3 as getInstance, getStorage$3 as getStorage, getType$3 as getType, getTypeByList$3 as getTypeByList, getValue$3 as getValue, inherit$3 as inherit, isNotObject$3 as isNotObject, isWindow$3 as isWindow, jsonToString$3 as jsonToString, logLoop$3 as logLoop, logOneLine$3 as logOneLine, messageCenter, mixIn$3 as mixIn, quadraticBezier$3 as quadraticBezier, randomNum$3 as randomNum, removeHandler$3 as removeHandler, requestFrame$1 as requestFrame, setStorage$3 as setStorage, setValue$3 as setValue, stopBubble$3 as stopBubble, stopDefault$3 as stopDefault, stringToJson$3 as stringToJson, throttle$3 as throttle, toKebabCase, types$3 as types, urlJoin$3 as urlJoin, urlSplit$3 as urlSplit };
|
package/dist/umd/base.d.ts
CHANGED
|
@@ -5,11 +5,13 @@ export declare const urlSplit: IUrlSplit;
|
|
|
5
5
|
export declare const urlJoin: IUrlJoin;
|
|
6
6
|
export declare const getType: IGetType<types>;
|
|
7
7
|
export declare const getTypeByList: IGetTypeByList;
|
|
8
|
+
export declare const toKebabCase: (camelCase: string, separator?: string) => string;
|
|
8
9
|
declare const _default: {
|
|
9
10
|
randomNum: IRandomNum;
|
|
10
11
|
urlSplit: IUrlSplit;
|
|
11
12
|
urlJoin: IUrlJoin;
|
|
12
13
|
getType: IGetType<types>;
|
|
13
14
|
getTypeByList: IGetTypeByList;
|
|
15
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
14
16
|
};
|
|
15
17
|
export default _default;
|
package/dist/umd/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ declare const _default: {
|
|
|
52
52
|
urlJoin: import("./types").IUrlJoin;
|
|
53
53
|
getType: import("./types").IGetType<import("./static").types>;
|
|
54
54
|
getTypeByList: import("./types").IGetTypeByList;
|
|
55
|
+
toKebabCase: (camelCase: string, separator?: string) => string;
|
|
55
56
|
getValue: import("./types").IGetValue;
|
|
56
57
|
setValue: import("./types").ISetValue;
|
|
57
58
|
mixIn: import("./types").IMixIn;
|
package/dist/umd/index.js
CHANGED
|
@@ -95,12 +95,17 @@
|
|
|
95
95
|
var __type = getType$3(data);
|
|
96
96
|
return whiteList.indexOf(__type) > 0;
|
|
97
97
|
};
|
|
98
|
+
var toKebabCase = function (camelCase, separator) {
|
|
99
|
+
if (separator === void 0) { separator = "-"; }
|
|
100
|
+
return camelCase.replace(/[A-Z]/g, function (m) { return "".concat(separator).concat(m.toLowerCase()); });
|
|
101
|
+
};
|
|
98
102
|
var base$3 = {
|
|
99
103
|
randomNum: randomNum$3,
|
|
100
104
|
urlSplit: urlSplit$3,
|
|
101
105
|
urlJoin: urlJoin$3,
|
|
102
106
|
getType: getType$3,
|
|
103
107
|
getTypeByList: getTypeByList$3,
|
|
108
|
+
toKebabCase: toKebabCase,
|
|
104
109
|
};
|
|
105
110
|
|
|
106
111
|
var getValue$3 = function (object, key, defaultValue) {
|
|
@@ -6151,6 +6156,7 @@
|
|
|
6151
6156
|
exports.stopDefault = stopDefault$3;
|
|
6152
6157
|
exports.stringToJson = stringToJson$3;
|
|
6153
6158
|
exports.throttle = throttle$3;
|
|
6159
|
+
exports.toKebabCase = toKebabCase;
|
|
6154
6160
|
exports.urlJoin = urlJoin$3;
|
|
6155
6161
|
exports.urlSplit = urlSplit$3;
|
|
6156
6162
|
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "utils-lib-js",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "JavaScript工具函数,封装的一些常用的js函数",
|
|
5
|
-
"main": "./dist/cjs/index.js",
|
|
6
|
-
"types": "./dist/cjs/index.d.ts",
|
|
7
|
-
"module": "./dist/esm/index.js",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"exports": {
|
|
10
|
-
"import": "./dist/esm/index.js",
|
|
11
|
-
"require": "./dist/cjs/index.js"
|
|
12
|
-
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "utils-lib-js",
|
|
3
|
+
"version": "2.0.15",
|
|
4
|
+
"description": "JavaScript工具函数,封装的一些常用的js函数",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"types": "./dist/cjs/index.d.ts",
|
|
7
|
+
"module": "./dist/esm/index.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
"import": "./dist/esm/index.js",
|
|
11
|
+
"require": "./dist/cjs/index.js"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://gitee.com/DieHunter/utils-lib-js.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"utils",
|
|
19
|
+
"tools",
|
|
20
|
+
"lib"
|
|
21
|
+
],
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@rollup/plugin-alias": "^4.0.3",
|
|
26
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
27
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
28
|
+
"@types/node": "^18.7.15",
|
|
29
|
+
"rollup": "^3.20.2",
|
|
30
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
31
|
+
"tslib": "^2.5.0",
|
|
32
|
+
"typescript": "^4.9.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"event-message-center": "^1.4.0",
|
|
36
|
+
"js-request-lib": "^1.0.7",
|
|
37
|
+
"task-queue-lib": "^1.4.2",
|
|
38
|
+
"timer-manager-lib": "^1.0.0"
|
|
39
|
+
},
|
|
40
|
+
"umdModuleName": "UtilsLib",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"debug": "start cmd /k pnpm run build:hot & pnpm run node:hot",
|
|
43
|
+
"node:hot": "nodemon example.js --watch example.js",
|
|
44
|
+
"build:hot": "pnpm rollup -c --watch",
|
|
45
|
+
"build": "pnpm run rollup:build && pnpm run commonjs",
|
|
46
|
+
"rollup:build": "rm -fr dist && pnpm rollup -c",
|
|
47
|
+
"build:publish": "pnpm run build && pnpm publish",
|
|
48
|
+
"commonjs": "cp ./commonjs.json dist/cjs/package.json"
|
|
49
|
+
}
|
|
50
|
+
}
|