mazey 4.7.3 → 4.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -82
- package/lib/debug.d.ts +9 -9
- package/lib/index.cjs.js +2 -2
- package/lib/index.esm.js +2 -2
- package/lib/load.d.ts +10 -10
- package/lib/load.d.ts.map +1 -1
- package/lib/mazey.min.js +2 -2
- package/lib/perf.d.ts +5 -5
- package/lib/store.d.ts +25 -25
- package/lib/typing.d.ts +3 -1
- package/lib/url.d.ts +38 -38
- package/lib/util.d.ts +178 -51
- package/lib/util.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/README.md +1 -1
- package/scripts/dev.js +0 -16
- package/scripts/git-helper.js +4 -4
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD041 -->
|
|
2
|
+
|
|
1
3
|
English | [简体中文](https://github.com/mazeyqian/mazey/blob/main/README_ZH.md)
|
|
2
4
|
|
|
3
5
|
# Mazey
|
|
@@ -35,11 +37,11 @@ Example: Use a function to verify if a value is a number suitable for standard c
|
|
|
35
37
|
Import from [npm](https://www.npmjs.com/package/mazey).
|
|
36
38
|
|
|
37
39
|
```javascript
|
|
38
|
-
import { isNumber } from
|
|
40
|
+
import { isNumber } from "mazey";
|
|
39
41
|
|
|
40
42
|
const x = 123;
|
|
41
43
|
const y = Infinity;
|
|
42
|
-
// <=> typeof x ===
|
|
44
|
+
// <=> typeof x === "number" && !isNaN(x) && isFinite(x)
|
|
43
45
|
isNumber(x); // Output: true
|
|
44
46
|
isNumber(y); // Output: false
|
|
45
47
|
```
|
|
@@ -50,7 +52,7 @@ Import from CDN.
|
|
|
50
52
|
<script type="text/javascript" src="//i.mazey.net/mazey/lib/mazey.min.js"></script>
|
|
51
53
|
<script>
|
|
52
54
|
const x = Infinity;
|
|
53
|
-
// <=> typeof x ===
|
|
55
|
+
// <=> typeof x === "string" && !isNaN(x)
|
|
54
56
|
mazey.isNumber(x, { isInfinityAsNumber: true }); // Output: true
|
|
55
57
|
</script>
|
|
56
58
|
```
|
|
@@ -118,9 +120,9 @@ Usage:
|
|
|
118
120
|
|
|
119
121
|
```javascript
|
|
120
122
|
loadScript(
|
|
121
|
-
|
|
123
|
+
"http://example.com/static/js/plugin-2.1.1.min.js",
|
|
122
124
|
{
|
|
123
|
-
id:
|
|
125
|
+
id: "iamid", // (Optional) script ID, default none
|
|
124
126
|
timeout: 5000, // (Optional) timeout, default `5000`
|
|
125
127
|
isDefer: false, // (Optional) defer, default `false`
|
|
126
128
|
}
|
|
@@ -145,17 +147,17 @@ Load JavaScript script: loaded
|
|
|
145
147
|
|
|
146
148
|
#### loadScriptIfUndefined
|
|
147
149
|
|
|
148
|
-
Load a script from the given URL if it (`window[
|
|
150
|
+
Load a script from the given URL if it (`window["attribute"]`) has not already been loaded.
|
|
149
151
|
|
|
150
152
|
Usage:
|
|
151
153
|
|
|
152
154
|
```javascript
|
|
153
|
-
loadScriptIfUndefined(
|
|
155
|
+
loadScriptIfUndefined("xyz", "https://example.com/lib/xyz.min.js")
|
|
154
156
|
.then(() => {
|
|
155
|
-
console.log(
|
|
157
|
+
console.log("xyz is loaded.");
|
|
156
158
|
})
|
|
157
159
|
.catch(err => {
|
|
158
|
-
console.log(
|
|
160
|
+
console.log("Failed to load xyz.", err);
|
|
159
161
|
});
|
|
160
162
|
```
|
|
161
163
|
|
|
@@ -173,9 +175,9 @@ Usage:
|
|
|
173
175
|
|
|
174
176
|
```javascript
|
|
175
177
|
loadCSS(
|
|
176
|
-
|
|
178
|
+
"https://example.com/path/example.css",
|
|
177
179
|
{
|
|
178
|
-
id:
|
|
180
|
+
id: "iamid", // Optional, link ID, default none
|
|
179
181
|
}
|
|
180
182
|
)
|
|
181
183
|
.then(
|
|
@@ -207,7 +209,7 @@ Note that this method will not add the image to the DOM.
|
|
|
207
209
|
Usage:
|
|
208
210
|
|
|
209
211
|
```javascript
|
|
210
|
-
loadImage(
|
|
212
|
+
loadImage("https://example.com/example.png")
|
|
211
213
|
.then((img) => {
|
|
212
214
|
console.log(img);
|
|
213
215
|
})
|
|
@@ -248,7 +250,7 @@ Usage:
|
|
|
248
250
|
|
|
249
251
|
```javascript
|
|
250
252
|
const ret1 = isNumber(123);
|
|
251
|
-
const ret2 = isNumber(
|
|
253
|
+
const ret2 = isNumber("123");
|
|
252
254
|
// Default: NaN, Infinity is not Number
|
|
253
255
|
const ret3 = isNumber(Infinity);
|
|
254
256
|
const ret4 = isNumber(Infinity, { isInfinityAsNumber: true });
|
|
@@ -297,12 +299,12 @@ const validData = {
|
|
|
297
299
|
}
|
|
298
300
|
}
|
|
299
301
|
};
|
|
300
|
-
const isValidDataResA = isValidData(validData, [
|
|
301
|
-
const isValidDataResB = isValidData(validData, [
|
|
302
|
-
const isValidDataResC = isValidData(validData, [
|
|
303
|
-
console.log(
|
|
304
|
-
console.log(
|
|
305
|
-
console.log(
|
|
302
|
+
const isValidDataResA = isValidData(validData, ["a", "b", "c"], 2333);
|
|
303
|
+
const isValidDataResB = isValidData(validData, ["a", "b", "c"], 413);
|
|
304
|
+
const isValidDataResC = isValidData(validData, ["d", "d"], 413);
|
|
305
|
+
console.log("isValidDataResA:", isValidDataResA);
|
|
306
|
+
console.log("isValidDataResB:", isValidDataResB);
|
|
307
|
+
console.log("isValidDataResC:", isValidDataResC);
|
|
306
308
|
```
|
|
307
309
|
|
|
308
310
|
Output:
|
|
@@ -315,7 +317,7 @@ isValidDataResC: false
|
|
|
315
317
|
|
|
316
318
|
#### genRndNumString
|
|
317
319
|
|
|
318
|
-
Produce a random string of number, `genRndNumString(7)` =>
|
|
320
|
+
Produce a random string of number, `genRndNumString(7)` => "7658495".
|
|
319
321
|
|
|
320
322
|
Usage:
|
|
321
323
|
|
|
@@ -341,13 +343,13 @@ Usage:
|
|
|
341
343
|
|
|
342
344
|
```javascript
|
|
343
345
|
const ret1 = formatDate();
|
|
344
|
-
const ret2 = formatDate(
|
|
345
|
-
const ret3 = formatDate(1641881235000,
|
|
346
|
-
const ret4 = formatDate(new Date(2014, 1, 11),
|
|
347
|
-
console.log(
|
|
348
|
-
console.log(
|
|
349
|
-
console.log(
|
|
350
|
-
console.log(
|
|
346
|
+
const ret2 = formatDate("Tue Jan 11 2022 14:12:26 GMT+0800 (China Standard Time)", "yyyy-MM-dd hh:mm:ss");
|
|
347
|
+
const ret3 = formatDate(1641881235000, "yyyy-MM-dd hh:mm:ss");
|
|
348
|
+
const ret4 = formatDate(new Date(2014, 1, 11), "MM/dd/yyyy");
|
|
349
|
+
console.log("Default formatDate value:", ret1);
|
|
350
|
+
console.log("String formatDate value:", ret2);
|
|
351
|
+
console.log("Number formatDate value:", ret3);
|
|
352
|
+
console.log("Date formatDate value:", ret4);
|
|
351
353
|
```
|
|
352
354
|
|
|
353
355
|
Output:
|
|
@@ -367,7 +369,7 @@ Usage:
|
|
|
367
369
|
|
|
368
370
|
```javascript
|
|
369
371
|
const foo = debounce(() => {
|
|
370
|
-
console.log(
|
|
372
|
+
console.log("The debounced function will only be invoked in 1000 milliseconds, the other invoking will disappear during the wait time.");
|
|
371
373
|
}, 1000, true);
|
|
372
374
|
```
|
|
373
375
|
|
|
@@ -379,7 +381,7 @@ Usage:
|
|
|
379
381
|
|
|
380
382
|
```javascript
|
|
381
383
|
const foo = throttle(() => {
|
|
382
|
-
console.log(
|
|
384
|
+
console.log("The function will be invoked at most once per every wait 1000 milliseconds.");
|
|
383
385
|
}, 1000, { leading: true });
|
|
384
386
|
```
|
|
385
387
|
|
|
@@ -392,8 +394,8 @@ Transfer CamelCase to KebabCase.
|
|
|
392
394
|
Usage:
|
|
393
395
|
|
|
394
396
|
```javascript
|
|
395
|
-
const ret1 = convertCamelToKebab(
|
|
396
|
-
const ret2 = convertCamelToKebab(
|
|
397
|
+
const ret1 = convertCamelToKebab("ABC");
|
|
398
|
+
const ret2 = convertCamelToKebab("aBC");
|
|
397
399
|
console.log(ret1);
|
|
398
400
|
console.log(ret2);
|
|
399
401
|
```
|
|
@@ -412,8 +414,8 @@ Transfer CamelCase to Underscore.
|
|
|
412
414
|
Usage:
|
|
413
415
|
|
|
414
416
|
```javascript
|
|
415
|
-
const ret1 = convertCamelToUnder(
|
|
416
|
-
const ret2 = convertCamelToUnder(
|
|
417
|
+
const ret1 = convertCamelToUnder("ABC");
|
|
418
|
+
const ret2 = convertCamelToUnder("aBC");
|
|
417
419
|
console.log(ret1);
|
|
418
420
|
console.log(ret2);
|
|
419
421
|
```
|
|
@@ -432,8 +434,8 @@ Copy/Clone Object deeply.
|
|
|
432
434
|
Usage:
|
|
433
435
|
|
|
434
436
|
```javascript
|
|
435
|
-
const ret1 = deepCopy([
|
|
436
|
-
const ret2 = deepCopy(
|
|
437
|
+
const ret1 = deepCopy(["a", "b", "c"]);
|
|
438
|
+
const ret2 = deepCopy("abc");
|
|
437
439
|
console.log(ret1);
|
|
438
440
|
console.log(ret2);
|
|
439
441
|
```
|
|
@@ -441,7 +443,7 @@ console.log(ret2);
|
|
|
441
443
|
Output:
|
|
442
444
|
|
|
443
445
|
```text
|
|
444
|
-
[
|
|
446
|
+
["a", "b", "c"]
|
|
445
447
|
abc
|
|
446
448
|
```
|
|
447
449
|
|
|
@@ -456,8 +458,8 @@ Usage:
|
|
|
456
458
|
```javascript
|
|
457
459
|
// http://example.com/?t1=1&t2=2&t3=3&t4=4#2333
|
|
458
460
|
// ?t1=1&t2=2&t3=3&t4=4
|
|
459
|
-
const p1 = getQueryParam(
|
|
460
|
-
const p2 = getQueryParam(
|
|
461
|
+
const p1 = getQueryParam("t3");
|
|
462
|
+
const p2 = getQueryParam("t4");
|
|
461
463
|
console.log(p1, p2);
|
|
462
464
|
```
|
|
463
465
|
|
|
@@ -474,8 +476,8 @@ Returns the value of the specified query parameter in the input URL.
|
|
|
474
476
|
Usage:
|
|
475
477
|
|
|
476
478
|
```javascript
|
|
477
|
-
const p1 = getUrlParam(
|
|
478
|
-
const p2 = getUrlParam(
|
|
479
|
+
const p1 = getUrlParam("https://example.com/?t1=1&t2=2&t3=3&t4=4", "t3");
|
|
480
|
+
const p2 = getUrlParam("https://example.com/?t1=1&t2=2&t3=3&t4=4", "t4");
|
|
479
481
|
console.log(p1, p2);
|
|
480
482
|
```
|
|
481
483
|
|
|
@@ -494,8 +496,8 @@ Usage:
|
|
|
494
496
|
```javascript
|
|
495
497
|
// http://example.com/?#2333?t1=1&t2=2&t3=3&t4=4
|
|
496
498
|
// #2333?t1=1&t2=2&t3=3&t4=4
|
|
497
|
-
const p1 = getHashQueryParam(
|
|
498
|
-
const p2 = getHashQueryParam(
|
|
499
|
+
const p1 = getHashQueryParam("t3");
|
|
500
|
+
const p2 = getHashQueryParam("t4");
|
|
499
501
|
console.log(p1, p2);
|
|
500
502
|
```
|
|
501
503
|
|
|
@@ -512,12 +514,12 @@ Get the domain of URL, and other params.
|
|
|
512
514
|
Usage:
|
|
513
515
|
|
|
514
516
|
```javascript
|
|
515
|
-
const ret1 = getDomain(
|
|
516
|
-
const ret2 = getDomain(
|
|
517
|
-
const ret3 = getDomain(
|
|
518
|
-
const ret4 = getDomain(
|
|
519
|
-
const ret5 = getDomain(
|
|
520
|
-
const ret6 = getDomain(
|
|
517
|
+
const ret1 = getDomain("http://example.com/?t1=1&t2=2&t3=3&t4=4");
|
|
518
|
+
const ret2 = getDomain("http://example.com/test/thanks?t1=1&t2=2&t3=3&t4=4", ["hostname", "pathname"]);
|
|
519
|
+
const ret3 = getDomain("http://example.com:7890/test/thanks", ["hostname"]);
|
|
520
|
+
const ret4 = getDomain("http://example.com:7890/test/thanks", ["host"]); // With Port
|
|
521
|
+
const ret5 = getDomain("http://example.com:7890/test/thanks", ["origin"]);
|
|
522
|
+
const ret6 = getDomain("http://example.com:7890/test/thanks?id=1", ["origin", "pathname", "search"]);
|
|
521
523
|
console.log(ret1);
|
|
522
524
|
console.log(ret2);
|
|
523
525
|
console.log(ret3);
|
|
@@ -544,8 +546,8 @@ Update the query param's value of the input URL.
|
|
|
544
546
|
Usage:
|
|
545
547
|
|
|
546
548
|
```javascript
|
|
547
|
-
const ret1 = updateQueryParam(
|
|
548
|
-
const ret2 = updateQueryParam(
|
|
549
|
+
const ret1 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t3", "three");
|
|
550
|
+
const ret2 = updateQueryParam("http://example.com/?t1=1&t2=2&t3=3&t4=4", "t4", "four");
|
|
549
551
|
console.log(ret1);
|
|
550
552
|
console.log(ret2);
|
|
551
553
|
```
|
|
@@ -564,11 +566,11 @@ Checks if the given string is a valid URL, including **scheme URLs**.
|
|
|
564
566
|
Usage:
|
|
565
567
|
|
|
566
568
|
```javascript
|
|
567
|
-
const ret1 = isValidUrl(
|
|
568
|
-
const ret2 = isValidUrl(
|
|
569
|
-
const ret3 = isValidUrl(
|
|
570
|
-
const ret4 = isValidUrl(
|
|
571
|
-
const ret5 = isValidUrl(
|
|
569
|
+
const ret1 = isValidUrl("https://www.example.com");
|
|
570
|
+
const ret2 = isValidUrl("http://example.com/path/exx/ss");
|
|
571
|
+
const ret3 = isValidUrl("https://www.example.com/?q=hello&age=24#world");
|
|
572
|
+
const ret4 = isValidUrl("http://www.example.com/#world?id=9");
|
|
573
|
+
const ret5 = isValidUrl("ftp://example.com");
|
|
572
574
|
console.log(ret1, ret2, ret3, ret4, ret5);
|
|
573
575
|
```
|
|
574
576
|
|
|
@@ -588,11 +590,11 @@ Check if the given string is a valid HTTP/HTTPS URL.
|
|
|
588
590
|
Usage:
|
|
589
591
|
|
|
590
592
|
```javascript
|
|
591
|
-
const ret1 = isValidHttpUrl(
|
|
592
|
-
const ret2 = isValidHttpUrl(
|
|
593
|
-
const ret3 = isValidHttpUrl(
|
|
594
|
-
const ret4 = isValidHttpUrl(
|
|
595
|
-
const ret5 = isValidHttpUrl(
|
|
593
|
+
const ret1 = isValidHttpUrl("https://www.example.com");
|
|
594
|
+
const ret2 = isValidHttpUrl("http://example.com/path/exx/ss");
|
|
595
|
+
const ret3 = isValidHttpUrl("https://www.example.com/?q=hello&age=24#world");
|
|
596
|
+
const ret4 = isValidHttpUrl("http://www.example.com/#world?id=9");
|
|
597
|
+
const ret5 = isValidHttpUrl("ftp://example.com");
|
|
596
598
|
console.log(ret1, ret2, ret3, ret4, ret5);
|
|
597
599
|
```
|
|
598
600
|
|
|
@@ -611,8 +613,8 @@ Handle Cookie.
|
|
|
611
613
|
Usage:
|
|
612
614
|
|
|
613
615
|
```javascript
|
|
614
|
-
setCookie(
|
|
615
|
-
const ret = getCookie(
|
|
616
|
+
setCookie("test", "123", 30, "example.com"); // key value day domain
|
|
617
|
+
const ret = getCookie("test");
|
|
616
618
|
console.log(ret);
|
|
617
619
|
```
|
|
618
620
|
|
|
@@ -629,14 +631,14 @@ Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
|
629
631
|
Usage:
|
|
630
632
|
|
|
631
633
|
```javascript
|
|
632
|
-
setSessionStorage(
|
|
633
|
-
const ret1 = getSessionStorage(
|
|
634
|
-
setLocalStorage(
|
|
635
|
-
const ret2 = getLocalStorage(
|
|
634
|
+
setSessionStorage("test", "123");
|
|
635
|
+
const ret1 = getSessionStorage("test");
|
|
636
|
+
setLocalStorage("test", "123");
|
|
637
|
+
const ret2 = getLocalStorage("test");
|
|
636
638
|
console.log(ret1, ret2);
|
|
637
639
|
|
|
638
640
|
// or package in usage
|
|
639
|
-
const projectName =
|
|
641
|
+
const projectName = "mazey";
|
|
640
642
|
function mSetLocalStorage (key, value) {
|
|
641
643
|
return setLocalStorage(`${projectName}_${key}`, value);
|
|
642
644
|
}
|
|
@@ -668,7 +670,7 @@ addStyle(
|
|
|
668
670
|
}
|
|
669
671
|
`,
|
|
670
672
|
{
|
|
671
|
-
id:
|
|
673
|
+
id: "test",
|
|
672
674
|
}
|
|
673
675
|
);
|
|
674
676
|
// <style id="test">
|
|
@@ -702,14 +704,14 @@ Modify `class`.
|
|
|
702
704
|
Usage:
|
|
703
705
|
|
|
704
706
|
```javascript
|
|
705
|
-
const dom = document.querySelector(
|
|
707
|
+
const dom = document.querySelector("#box");
|
|
706
708
|
|
|
707
709
|
// Determine `class`
|
|
708
|
-
hasClass(dom,
|
|
710
|
+
hasClass(dom, "test");
|
|
709
711
|
// Add `class`
|
|
710
|
-
addClass(dom,
|
|
712
|
+
addClass(dom, "test");
|
|
711
713
|
// Remove `class`
|
|
712
|
-
removeClass(dom,
|
|
714
|
+
removeClass(dom, "test");
|
|
713
715
|
```
|
|
714
716
|
|
|
715
717
|
#### newLine
|
|
@@ -719,8 +721,8 @@ Make a new line of HTML.
|
|
|
719
721
|
Usage:
|
|
720
722
|
|
|
721
723
|
```javascript
|
|
722
|
-
const ret1 = newLine(
|
|
723
|
-
const ret2 = newLine(
|
|
724
|
+
const ret1 = newLine("a\nb\nc");
|
|
725
|
+
const ret2 = newLine("a\n\nbc");
|
|
724
726
|
console.log(ret1);
|
|
725
727
|
console.log(ret2);
|
|
726
728
|
```
|
|
@@ -774,7 +776,7 @@ Computes the longest common substring of two strings.
|
|
|
774
776
|
Usage:
|
|
775
777
|
|
|
776
778
|
```javascript
|
|
777
|
-
const ret = longestComSubstring(
|
|
779
|
+
const ret = longestComSubstring("fish", "finish");
|
|
778
780
|
console.log(ret);
|
|
779
781
|
```
|
|
780
782
|
|
|
@@ -791,7 +793,7 @@ Computes the longest common subsequence of two strings.
|
|
|
791
793
|
Usage:
|
|
792
794
|
|
|
793
795
|
```javascript
|
|
794
|
-
const ret = longestComSubsequence(
|
|
796
|
+
const ret = longestComSubsequence("fish", "finish");
|
|
795
797
|
console.log(ret);
|
|
796
798
|
```
|
|
797
799
|
|
|
@@ -839,7 +841,7 @@ Example: Determine the environment of the mobile QQ.
|
|
|
839
841
|
|
|
840
842
|
```javascript
|
|
841
843
|
const { system, shell } = getBrowserInfo();
|
|
842
|
-
const isMobileQQ = [
|
|
844
|
+
const isMobileQQ = ["android", "ios"].includes(system) && ["qq_browser", "qq_app"].includes(shell);
|
|
843
845
|
```
|
|
844
846
|
|
|
845
847
|
#### isSafePWAEnv
|
|
@@ -912,11 +914,11 @@ Custom console printing (`console`).
|
|
|
912
914
|
Usage:
|
|
913
915
|
|
|
914
916
|
```javascript
|
|
915
|
-
const myConsole = genCustomConsole(
|
|
916
|
-
myConsole.log(
|
|
917
|
-
myConsole.info(
|
|
918
|
-
myConsole.info(
|
|
919
|
-
myConsole.info(
|
|
917
|
+
const myConsole = genCustomConsole("MazeyLog:");
|
|
918
|
+
myConsole.log("I am string.");
|
|
919
|
+
myConsole.info("I am boolean.", true);
|
|
920
|
+
myConsole.info("I am number.", 123, 456);
|
|
921
|
+
myConsole.info("I am object.", { a: 123, b: 456});
|
|
920
922
|
```
|
|
921
923
|
|
|
922
924
|
Output:
|
package/lib/debug.d.ts
CHANGED
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
* Usage:
|
|
7
7
|
*
|
|
8
8
|
* ```javascript
|
|
9
|
-
* const myConsole = genCustomConsole(
|
|
10
|
-
* myConsole.log(
|
|
11
|
-
* myConsole.info(
|
|
12
|
-
* myConsole.info(
|
|
13
|
-
* myConsole.info(
|
|
9
|
+
* const myConsole = genCustomConsole("[MazeyLog]");
|
|
10
|
+
* myConsole.log("I am string.");
|
|
11
|
+
* myConsole.info("I am boolean.", true);
|
|
12
|
+
* myConsole.info("I am number.", 123, 456);
|
|
13
|
+
* myConsole.info("I am object.", { a: 123, b: 456});
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
16
|
* Output:
|
|
17
17
|
*
|
|
18
18
|
* ```text
|
|
19
|
-
* MazeyLog
|
|
20
|
-
* MazeyLog
|
|
21
|
-
* MazeyLog
|
|
22
|
-
* MazeyLog
|
|
19
|
+
* [MazeyLog] I am string.
|
|
20
|
+
* [MazeyLog] I am boolean. true
|
|
21
|
+
* [MazeyLog] I am number. 123 456
|
|
22
|
+
* [MazeyLog] I am object. {a: 123, b: 456}
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
25
|
* @param {string} prefix 前缀
|
package/lib/index.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Mazey v4.7.
|
|
2
|
+
* Mazey v4.7.5 https://github.com/mazeyqian/mazey
|
|
3
3
|
* (c) 2018-2024 Cheng
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var e=function(){return e=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},e.apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(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(a,s)}c((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function r(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 o(t){if("object"!=typeof t)return t;var n=["string","number","boolean","undefined"];return Object.values(t).every((function(e){return n.includes(typeof e)}))?e({},t):JSON.parse(JSON.stringify(t))}function i(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();return"-"===t[0]?t.substring(1):t}function a(e){var t=e.replace(/([A-Z])/g,"_$1").toLowerCase();return"_"===t[0]?t.substring(1):t}function s(e){return a(e)}function c(e){try{if("object"==typeof JSON.parse(e))return!0}catch(e){}return!1}function u(e){void 0===e&&(e=5);for(var t="";e--;)t+=Math.floor(10*Math.random());return t}function d(e){return void 0===e&&(e=5),u(e)}function f(e){void 0===e&&(e=3);var t=[l(),d(e||3)];return t[0]+t[1]}function l(){return Date.now?Date.now():(new Date).getTime()}"function"==typeof SuppressedError&&SuppressedError;var p={type:"d"};function g(e,t){void 0===t&&(t={});var n=t.isNaNAsNumber,r=void 0!==n&&n,o=t.isInfinityAsNumber,i=void 0!==o&&o,a=t.isUnFiniteAsNumber;return"number"==typeof e&&(!(!0!==i&&!0!==(void 0!==a&&a)&&!isFinite(e))&&!(!r&&isNaN(e)))}function v(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=null;return e&&"function"==typeof e&&(r=e.apply(void 0,t)),r}function m(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return v.apply(void 0,r([e],t,!1))}function h(e){var t=!1;return Array.isArray(e)&&e.length&&(t=!0),t}function w(e){var t=Boolean(e),n="object"==typeof e,r="[object Object]"===Object.prototype.toString.call(e);return t&&n&&r}function y(e){if(!e)return"";var t=new RegExp("\\n","g");return e.replace(t,"<br />")}function x(e,t){void 0===t&&(t={});var n=t.removeNewLine,r=void 0!==n&&n,o="";return e&&(o=e.replace(/<\/?.+?>/g,""),r&&(o=o.replace(/[\r\n]/g,""))),o}function b(e){var t={"&":"&","<":"<",">":">",""":'"',"'":"'","/":"/"};if("string"!=typeof e)throw new Error("Input must be a string");return e.replace(/(&|<|>|"|'|/)/g,(function(e){return t[e]}))}function S(e,t,n){if(void 0===n&&(n={hasDot:!1,dotText:"..."}),n=Object.assign({hasDot:!1,dotText:"..."},n),""!=e&&e){for(var r=0,o="",i=/[^\x00-\xff]/g,a="",s=e.replace(i,"**").length,c=0;c<s&&(null!=(a=e.charAt(c).toString()).match(i)?r+=2:r++,!(r>t));c++)o+=a;return n.hasDot&&s>t&&(o+=n.dotText),o}return""}function E(e,t,n){return void 0===n&&(n=!1),S(e,t,{hasDot:n})}function T(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,new Promise((function(t){setTimeout((function(){t(e)}),e)}))]}))}))}var A="";function C(e,t){for(var n=e.length,r=t.length,i=o(new Array(n).fill(new Array(r).fill(0))),a=0;a<n;++a)for(var s=0;s<r;++s)if(e[a]===t[s]){var c=0;a>0&&s>0&&(c=i[a-1][s-1]),i[a][s]=c+1}var u=Array.prototype.concat.apply([],i);return Math.max.apply(Math,u)}function O(e,t){for(var n=e.length,r=t.length,i=o(new Array(n).fill(new Array(r).fill(0))),a=0;a<n;++a)for(var s=0;s<r;++s)if(e[a]===t[s]){var c=0;a>0&&s>0&&(c=i[a-1][s-1]),i[a][s]=c+1}else{var u=[0,0],d=u[0],f=u[1];s>0&&(d=i[a][s-1]),a>0&&(f=i[a-1][s]),i[a][s]=Math.max(d,f)}var l=Array.prototype.concat.apply([],i);return Math.max.apply(Math,l)}function P(e){return Math.random()<e}function M(e,t){void 0===t&&(t={strict:!0});var n=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9\u4E00-\u9FA5()!@:%_+.~#?&//=]*)/;return t.strict||(n=/^(https?:)?\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9\u4E00-\u9FA5()!@:%_+.~#?&//=]*)/),n.test(e)}function k(e){return e.replace(/^http:/,"https:")}function N(e){void 0===e&&(e="");var t=window.URL;if(!t)return!1;if(!t.canParse)return!1;if("function"!=typeof t.canParse)return!1;try{var n=new t("b","http://a");return n.pathname="c d","http://a/c%20d"===n.href&&Boolean(n.searchParams)&&t.canParse(e)}catch(e){return!1}}function _(e,t){void 0===e&&(e=""),void 0===t&&(t={isClosed:!1,showWrap:!1,showDate:!1,locales:"en-US",logFn:function(){},errorFn:function(){}});var n=Object.assign({isClosed:!1,showWrap:!1,showDate:!1,locales:"en-US",logFn:function(){},errorFn:function(){}},t),o=n.isClosed,i=n.showWrap,a=n.showDate,s=n.locales,c=n.logFn,u=n.errorFn,d=Object.create(null),f=function(){return(new Date).toLocaleDateString(s,{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})};return["log","info","warn","error"].forEach((function(t){d[t]=function(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];if(o)return!1;var d=e,l=e;if("string"==typeof e&&e.length>=2){var p=e.length;d=":"===e[p-1]?e.substring(0,p-1):e}i&&console.log("--- ".concat(d," - begin ---")),a&&(l=e?"".concat(f()," ").concat(e):"".concat(f())),e||a?console[t].apply(console,r([l],n,!1)):console[t].apply(console,n),"log"===t&&c(),"error"===t&&u(),i&&console.log("--- ".concat(d," - end ---"))}})),d}var R=_("[Mazey]");function j(e,t){if(e)if(Array.isArray(t))t.forEach((function(t){e.classList.add(t)}));else{for(var n=e.className,r=n.split(/\s+/),o=0;o<r.length;o++)if(r[o]===t)return;var i,a="";""!==n&&(a=" "),i=n+a+t,e.className=i}else R.error("The element is not exist.")}function B(){var e,t=window.jQuery||window.$;return t?!(!(e=t("img"))||!e.length)&&(e.each((function(){var e=t(this);if(e){var n=e.attr("src");if(n&&"string"==typeof n&&n.length){var r=n.match(/width=([0-9]+[a-z%]*)/),o=n.match(/height=([0-9]+[a-z%]*)/);r&&h(r)&&r[1]&&e.width(r[1]),o&&h(o)&&o[1]&&e.height(o[1])}}})),!0):(e=document.getElementsByTagName("img")).length>0&&(Array.from(e).forEach((function(e){var t=e;if(t){var n=t.getAttribute("src");if(n&&"string"==typeof n&&n.length){var r=n.match(/width=([0-9]+[a-z%]*)/),o=n.match(/height=([0-9]+[a-z%]*)/);r&&h(r)&&r[1]&&(t.style.width=r[1]),o&&h(o)&&o[1]&&(t.style.height=o[1])}}})),!0)}function L(){var e=window.MAZEY_DEFINE_LISTENERS;return"object"!=typeof e&&(e={},window.MAZEY_DEFINE_LISTENERS=e),e}function F(t,n){void 0===n&&(n={});var r=L()[t];if(r instanceof Array)for(var o=0,i=r.length;o<i;o++)"function"==typeof r[o]&&r[o](e(e({},n),{type:t}))}function I(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}function U(e){for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var r=t[n].trim();if(r.startsWith("".concat(e,"="))){var o=r.split("=")[0],i=new Date;return i.setTime(i.getTime()-1),document.cookie="".concat(o,"=;expires=").concat(i.toUTCString()),!0}}return!1}function D(e,t){void 0===t&&(t={id:"",callback:function(){},timeout:5e3,isDefer:!1});var n,r,o=Object.assign({id:"",callback:function(){},timeout:5e3,isDefer:!1},t),i=o.id,a=o.callback,s=o.timeout,c=o.isDefer,u=document.createElement("script");u||Promise.reject("Not support create script element");var d=document.getElementsByTagName("script")[0];return u.type="text/javascript",c&&(u.defer=!0),i&&(u.id=i),u.readyState?u.onreadystatechange=function(){"loaded"!==u.readyState&&"complete"!==u.readyState||(u.onreadystatechange=null,m(a),m(n,"loaded"))}:u.onload=function(){m(a),m(n,"loaded")},u.src=e,d&&d.parentNode.insertBefore(u,d),new Promise((function(e,t){var o;n=(o=[e,t])[0],r=o[1],s&&setTimeout(r.bind(null,"timeout"),s)}))}function z(e){var t=[],n=window.PerformanceObserver;return!!n&&(h(n.supportedEntryTypes)&&(t=n.supportedEntryTypes),t.includes(e))}function q(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("paint")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"first-contentful-paint"===e.name}));r&&(t.disconnect(),e(Math.round(r.startTime)))}));t.observe({type:"paint",buffered:!0})}))]:[2,0]}))}))}function H(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("paint")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"first-paint"===e.name}));r&&(t.disconnect(),e(Math.round(r.startTime)))}));t.observe({type:"paint",buffered:!0})}))]:[2,0]}))}))}var Z="";function V(){if(window.MAZEY_BROWSER_INFO&&"object"==typeof window.MAZEY_BROWSER_INFO)return window.MAZEY_BROWSER_INFO;var t={engine:"",engineVs:"",platform:"",supporter:"",supporterVs:"",system:"",systemVs:"",shell:"",shellVs:"",appleType:""};try{var n=navigator.userAgent.toLowerCase();if(!n)return t;var r=function(e){return e.test(n)},o=function(e){var t="",r=n.match(e);return r&&h(r)&&(t=(t=(t=r.toString()).replace(/[^0-9|_.]/g,"")).replace(/_/g,".")),t},i="",a="";r(/windows|win32|win64|wow32|wow64/g)?i="windows":r(/macintosh|macintel/g)?i="macos":r(/x11/g)?i="linux":r(/android|adr/g)?i="android":r(/ios|iphone|ipad|ipod|iwatch/g)&&(i="ios",r(/ipad/g)?a="ipad":r(/iphone/g)?a="iphone":r(/iwatch/g)?a="iwatch":r(/ipod/g)&&(a="ipod")),t=e(e({},t),{system:i,appleType:a});var s="";"windows"===i?r(/windows nt 5.0|windows 2000/g)?s="2000":r(/windows nt 5.1|windows xp/g)?s="xp":r(/windows nt 5.2|windows 2003/g)?s="2003":r(/windows nt 6.0|windows vista/g)?s="vista":r(/windows nt 6.1|windows 7/g)?s="7":r(/windows nt 6.2|windows 8/g)?s="8":r(/windows nt 6.3|windows 8.1/g)?s="8.1":r(/windows nt 10.0|windows 10/g)&&(s="10"):"macos"===i?s=o(/os x [\d._]+/g):"android"===i?s=o(/android [\d._]+/g):"ios"===i&&(s=o(/os [\d._]+/g)),t=e(e({},t),{systemVs:s});var c="";"windows"===i||"macos"===i||"linux"===i?c="desktop":("android"===i||"ios"===i||r(/mobile/g))&&(c="mobile"),t=e(e({},t),{platform:c});var u="",d="";r(/applewebkit/g)?(u="webkit",r(/edge/g)?d="edge":r(/opr/g)?d="opera":r(/chrome/g)?d="chrome":r(/safari/g)&&(d="safari")):r(/gecko/g)&&r(/firefox/g)?(u="gecko",d="firefox"):r(/presto/g)?(u="presto",d="opera"):r(/trident|compatible|msie/g)&&(u="trident",d="iexplore"),t=e(e({},t),{engine:u,supporter:d});var f="";"webkit"===u?f=o(/applewebkit\/[\d._]+/g):"gecko"===u?f=o(/gecko\/[\d._]+/g):"presto"===u?f=o(/presto\/[\d._]+/g):"trident"===u&&(f=o(/trident\/[\d._]+/g)),t=e(e({},t),{engineVs:f});var l="";"chrome"===d?l=o(/chrome\/[\d._]+/g):"safari"===d?l=o(/version\/[\d._]+/g):"firefox"===d?l=o(/firefox\/[\d._]+/g):"opera"===d?l=o(/opr\/[\d._]+/g):"iexplore"===d?l=o(/(msie [\d._]+)|(rv:[\d._]+)/g):"edge"===d&&(l=o(/edge\/[\d._]+/g)),t=e(e({},t),{supporterVs:l});var p="",g="";return r(/micromessenger/g)?(p="wechat",g=o(/micromessenger\/[\d._]+/g)):r(/qqbrowser/g)?(p="qq_browser",g=o(/qqbrowser\/[\d._]+/g)):r(/\sqq/g)?p="qq_app":r(/ucbrowser/g)?(p="uc",g=o(/ucbrowser\/[\d._]+/g)):r(/qihu 360se/g)?p="360":r(/2345explorer/g)?(p="2345",g=o(/2345explorer\/[\d._]+/g)):r(/metasr/g)?p="sougou":r(/lbbrowser/g)?p="liebao":r(/maxthon/g)?(p="maxthon",g=o(/maxthon\/[\d._]+/g)):r(/biliapp/g)&&(p="bilibili"),t=e(e({},t),{shell:p,shellVs:g}),window.MAZEY_BROWSER_INFO=t,t}catch(e){return R.warn(e),t}}var W="";exports.addClass=j,exports.addEvent=function(e,t){var n=L();void 0===n[e]&&(n[e]=[]),"function"==typeof t&&n[e].push(t)},exports.addStyle=function(e,t){if(void 0===t&&(t={id:""}),!e)return!1;var n=document.createDocumentFragment(),r=null,o="",i=document.createElement("style");return t.id?(o="".concat(t.id),(r=document.getElementById(o))?r.innerHTML=e:(i.setAttribute("id",t.id),i.innerHTML=e,n.appendChild(i),document.head.appendChild(n))):(i.innerHTML=e,n.appendChild(i),document.head.appendChild(n)),!0},exports.calLongestCommonSubsequence=function(e,t){return O(e,t)},exports.calLongestCommonSubstring=function(e,t){return C(e,t)},exports.camelCase2Underscore=s,exports.camelCaseToKebabCase=function(e){return i(e)},exports.cancelBubble=function(e){var t=e||window.event;t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},exports.clearHTML=function(e,t){return void 0===t&&(t={}),x(e,t)},exports.clearHtml=function(e,t){return void 0===t&&(t={}),x(e,t)},exports.convert10To26=function(e){for(var t="";e>0;){var n=e%26;0===n&&(n=26),t=String.fromCharCode(n+96)+t,e=(e-n)/26}return t},exports.convertCamelToKebab=i,exports.convertCamelToUnder=a,exports.convertHttpToHttps=k,exports.convertKebabToCamel=function(e){var t=e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}));return t.endsWith("-")?t.slice(0,-1):t},exports.convertObjectToQuery=function(e){if(e&&0===Object.keys(e).length)return"";var t="?";for(var n in e)t+="".concat(n,"=").concat(e[n],"&");return t.slice(0,-1)},exports.convertToHtmlBreaks=y,exports.cutCHSString=function(e,t,n){return void 0===n&&(n=!1),E(e,t,n)},exports.cutZHString=S,exports.debounce=function(e,t,n){var r=null,o=null,i=null,a=null,s=null,c=function c(){var u=l()-i;u<t&&u>=0?o=setTimeout(c,t-u):(o=null,n||(s=e.apply(r,a),o||(r=a=null)))};return function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];r=this,a=u,i=l();var f=n&&!o;return o||(o=setTimeout(c,t)),f&&(s=e.apply(r,a),r=a=null),s}},exports.deepCopy=o,exports.deepCopyObject=function(e){return o(e)},exports.delCookie=function(e){U(e)},exports.doFn=m,exports.fireEvent=F,exports.floatFixed=function(e,t){return void 0===t&&(t=0),parseFloat(e).toFixed(t)},exports.floatToPercent=function(e,t){void 0===t&&(t=0);var n="";return n=t?(100*e).toFixed(t):String(Math.floor(100*e)),"".concat(n,"%")},exports.formatDate=function(e,t){void 0===t&&(t="yyyy-MM-dd"),e||(e=new Date);var n=new Date(e),r=n.getHours(),o={yyyy:n.getFullYear(),MM:n.getMonth()+1,dd:n.getDate()<10?"0"+n.getDate():n.getDate(),HH:r<10?"0"+r:r,hh:(r%12||12)<10?"0"+(r%12||12):r%12||12,mm:n.getMinutes()<10?"0"+n.getMinutes():n.getMinutes(),ss:n.getSeconds()<10?"0"+n.getSeconds():n.getSeconds(),a:r<12?"AM":"PM"},i=t||"yyyy-MM-dd";return Object.keys(o).forEach((function(e){var t=o[e];"MM"===e&&Number(t)<=9&&(t="0".concat(t)),i=i.replace(e,String(t))})),i},exports.genBrowserAttrs=function(e,t){void 0===e&&(e=""),void 0===t&&(t="-");var n=V(),r=[];return["system","platform","engine","supporter","shell","appleType"].forEach((function(o){var i=n[o];if(i){var a="";e&&e.length>0&&(a="".concat(e).concat(t)),r.push("".concat(a).concat(i))}})),r},exports.genCustomConsole=_,exports.genHashCode=function(e){var t,n=0;for(t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n},exports.genRndNumString=u,exports.genStyleString=function(e,t){var n="";return t&&t.length>0&&(n=t.join(";")+";"),"".concat(e,"{").concat(n,"}")},exports.genUniqueNumString=f,exports.generateRndNum=d,exports.generateUniqueNum=function(e){return void 0===e&&(e=3),f(e)},exports.getAllQueryParams=function(e){void 0===e&&(e=""),""===e&&(e=location.search);var t={};return e.replace(/\??(\w+)=([^&]*)&?/g,(function(e,n,r){return void 0===t[n]&&(t[n]=decodeURIComponent(r)),""})),t},exports.getBrowserInfo=V,exports.getCLS=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("layout-shift")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().reduce((function(e,t){var n=0;return g(t.value)&&(n=t.value),e+n}),0);t.disconnect(),e(r)}));t.observe({type:"layout-shift",buffered:!0})}))]:[2,0]}))}))},exports.getCookie=I,exports.getCurrentVersion=function(){return"v4"},exports.getDefineListeners=L,exports.getDomain=function(e,t){if(void 0===t&&(t=["hostname"]),N(e)){var n=new window.URL(e);return t.reduce((function(e,t){return e+=n[t]}),"")}var r=document.createElement("a");return r.href=e,t.reduce((function(e,t){return e+=r[t]}),"")},exports.getFCP=q,exports.getFID=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("first-input")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"first-input"===e.entryType}));if(r){t.disconnect();var o=r.processingStart;e(o?Math.round(r.processingStart-r.startTime):0)}}));t.observe({type:"first-input",buffered:!0})}))]:[2,0]}))}))},exports.getFP=H,exports.getFileSize=function(e){var t=function(e){return String(Math.ceil(e))};if(!e||e<0)return"";var n=1024;return e<n?e+" B":e<Math.pow(n,2)?t(e/n)+" KB":e<Math.pow(n,3)?t(e/Math.pow(n,2))+" MB":e<Math.pow(n,4)?t(e/Math.pow(n,3))+" G":t(e/Math.pow(n,4))+" T"},exports.getFriendlyInterval=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=p);var r=(n=Object.assign(p,n)).type;g(e)||(e=new Date(e).getTime()),g(t)||(t=new Date(t).getTime());var o=Number(t)-Number(e),i="",a=new Array(4).fill(0),s=a[0],c=(a[1],a[2],a[3]),u=decodeURIComponent("%20%E5%A4%A9%20"),d=decodeURIComponent("%20%E6%97%B6%20"),f=decodeURIComponent("%20%E5%88%86%20"),l=decodeURIComponent("%20%E7%A7%92");if(o>=0)switch(s=Math.floor(o/1e3/60/60/24),Math.floor(o/1e3/60/60),Math.floor(o/1e3/60),c=Math.floor(o/1e3),r){case"d":i=s;break;case"text":i=(s=Math.floor(o/1e3/60/60/24))+u+Math.floor(o/1e3/60/60%24)+d+Math.floor(o/1e3/60%60)+f+(c=Math.floor(o/1e3%60))+l;break;default:i=c}return i},exports.getHashQueryParam=function(e){var t=location.hash.split("?");if(1===t.length)return"";var n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),r=t[1].match(n);return r?r[2]:""},exports.getLCP=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("largest-contentful-paint")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"largest-contentful-paint"===e.entryType}));r&&(t.disconnect(),e(Math.round(r.startTime)))}));t.observe({type:"largest-contentful-paint",buffered:!0})}))]:[2,0]}))}))},exports.getLocalStorage=function(e){var t=null;if(e){var n=localStorage.getItem(e);n&&(t=JSON.parse(n))}return t},exports.getPageMeta=function(e){var t;return document.querySelector&&(null===(t=document.querySelector('meta[name="'.concat(e,'"]')))||void 0===t?void 0:t.getAttribute("content"))||""},exports.getPerformance=function(e){return void 0===e&&(e=!1),t(this,void 0,void 0,(function(){function t(){var t={source:I,os:r(),osVersion:o(),deviceType:i(),network:a(),screenDirection:c(),unloadTime:w-y,redirectTime:x-b,dnsTime:S-E,tcpTime:T-A,sslTime:u(T,C),responseTime:O-P,downloadTime:M-O,firstPaintTime:Z,firstContentfulPaintTime:V,domReadyTime:k-U,onloadTime:N-U,whiteTime:O-U,renderTime:_-U,decodedBodySize:B,encodedBodySize:L};Object.keys(t).forEach((function(e){g(t[e])&&(t[e]<0?t[e]=0:t[e]=Math.round(t[e]))})),g(t.whiteTime)&&t.whiteTime>t.onloadTime&&(t.whiteTime=0);var n={};e||Object.keys(t).forEach((function(e){n[s(e)]=t[e]})),Object.keys(n).length?f(n):f(t)}function r(){return navigator.userAgent.indexOf("Android")>-1||navigator.userAgent.indexOf("Linux")>-1?"android":navigator.userAgent.indexOf("iPhone")>-1?"ios":navigator.userAgent.indexOf("Windows Phone")>-1?"wp":"others"}function o(){var e="",t=navigator.userAgent,n=t.indexOf("Android")>-1||t.indexOf("Linux")>-1,r=!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),o=navigator.userAgent.split(";");if(o.length<2)return e;var i=o[1];return i?(n&&(e=(i.match(/\d+\.\d+/g)||[])[0]),r&&(e=(i.match(/(\d+)_(\d+)_?(\d+)?/)||[])[0]),e||(e=""),e):e}function i(){var e,t=navigator.userAgent.toLowerCase(),n=t.match(/(ipad)/i)&&"ipad",r=t.match(/iphone os/i)&&"iphone os",o=t.match(/midp/i)&&"midp",i=t.match(/rv:1.2.3.4/i)&&"rv:1.2.3.4",a=t.match(/ucweb/i)&&"ucweb",s=t.match(/android/i)&&"android",c=t.match(/windows ce/i)&&"windows ce",u=t.match(/windows mobile/i)&&"windows mobile";return(e=n||r||o||i||a||s||c||u?r||o||i||a||s||c||u?"phone":n?"ipad":void 0:"pc")||(e=""),e}function a(){var e="",t=window.navigator;if(t.connection&&t.connection.effectiveType)switch(t.connection.effectiveType){case"wifi":e="wifi";break;case"4g":e="4g";break;case"2g":e="2g";break;case"3g":e="3g";break;case"ethernet":e="ethernet";break;case"default":e=void 0}return e||(e=""),e}function c(){var e="";return window.screen&&window.screen.orientation&&window.screen.orientation.angle&&(180!==window.screen.orientation.angle&&0!==window.screen.orientation.angle||(e="|"),90!==window.screen.orientation.angle&&-90!==window.screen.orientation.angle||(e="-")),e}function u(e,t){var n=0;return t&&(n=e-t),n}var d,f,l,p,v,m,w,y,x,b,S,E,T,A,C,O,P,M,k,N,_,R,j,B,L,F,I,U,D,Z,V;return n(this,(function(e){switch(e.label){case 0:if(!z("navigation"))return[2,Promise.reject(new Error("navigation is not supported"))];if(!(d=window.performance)||"function"!=typeof d.getEntries||"function"!=typeof d.getEntriesByType)return[2,Promise.reject(new Error("performance is not supported"))];if(l=new Promise((function(e){f=[e][0]})),p=null,h(v=d.getEntriesByType("navigation"))&&(p=v[0]),m=new Array(19).fill(0),w=m[0],y=m[1],x=m[2],b=m[3],S=m[4],E=m[5],T=m[6],A=m[7],C=m[8],O=m[9],P=m[10],M=m[11],k=m[12],N=m[13],_=m[14],R=m[15],j=m[16],B=m[17],L=m[18],F=d.timing,I="",p)I="PerformanceNavigationTiming",B=p.decodedBodySize,L=p.encodedBodySize,w=p.unloadEventEnd,y=p.unloadEventStart,x=p.redirectEnd,b=p.redirectStart,S=p.domainLookupEnd,E=p.domainLookupStart,T=p.connectEnd,A=p.connectStart,C=p.secureConnectionStart,O=p.responseStart,P=p.requestStart,M=p.responseEnd,k=p.domContentLoadedEventStart,N=p.loadEventStart,_=p.loadEventEnd,R=p.startTime,j=p.fetchStart;else{if(!F)return[2,Promise.reject(new Error("NavigationTiming and Timing are not supported"))];I="PerformanceTiming",w=F.unloadEventEnd,y=F.unloadEventStart,x=F.redirectEnd,b=F.redirectStart,S=F.domainLookupEnd,E=F.domainLookupStart,T=F.connectEnd,A=F.connectStart,C=F.secureConnectionStart,O=F.responseStart,P=F.requestStart,M=F.responseEnd,k=F.domContentLoadedEventStart,N=F.loadEventStart,_=F.loadEventEnd,R=F.navigationStart,j=F.fetchStart}if(U=0,g(R))U=R;else{if(!g(j))return[2,Promise.reject(new Error("startTime, navigationStart or fetchStart are required"))];U=j}return[4,Promise.all([H(),q()])];case 1:return D=e.sent(),Z=D[0],V=D[1],g(_)&&_>0?t():window.addEventListener("load",(function(){window.setTimeout((function(){t()}),0)})),[2,l]}}))}))},exports.getQueryParam=function(e){var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),n=location.search.substring(1).match(t);return null!==n?decodeURIComponent(n[2]):""},exports.getScriptQueryParam=function(e,t){void 0===t&&(t=""),t||(t=".js");for(var n=new RegExp("[?&]".concat(e,"=([^&]*)")),r=document.querySelectorAll('script[src*="'.concat(t,'"]')),o=0;o<r.length;o++){var i=r[o].getAttribute("src");if(i&&-1!==i.indexOf(t)){var a=i.match(n);if(a)return decodeURIComponent(a[1])}}return""},exports.getSessionStorage=function(e){var t=null;if(e){var n=sessionStorage.getItem(e);n&&(t=JSON.parse(n))}return t},exports.getTTFB=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){return z("navigation")&&window.performance&&window.performance.getEntriesByType?(e=performance.getEntriesByType("navigation")[0],0,e?(t=e.responseStart-e.requestStart,[2,Math.round(t)]):[2,0]):[2,0]}))}))},exports.getUrlFileType=function(e){var t="";if("string"!=typeof e||""==e)return t;var n=/\.[^/?#]+$/.exec(e);return n?(n[0].length>1&&(t=n[0].substring(1)),t):t},exports.getUrlHost=function(e){var t="";return!M(e)&&M(e,{strict:!1})&&0===e.indexOf("//")&&(e="https:"+e),N(e)&&(t=new URL(e).host),t},exports.getUrlParam=function(e,t,n){void 0===n&&(n={});var r=null;if(e.includes("#")){r=new URL(e).searchParams.getAll(t)}else{var o={};e.replace(/\??(\w+)=([^&]*)&?/g,(function(e,t,n){return void 0!==o[t]?o[t].push(n):o[t]=[n],""})),r=o[t]||[]}return n.returnArray?r:r.length?r[0]:null},exports.getUrlPath=function(e){var t="";return!M(e)&&M(e,{strict:!1})&&0===e.indexOf("//")&&(e="https:"+e),N(e)&&(t=new URL(e).pathname),t},exports.hasClass=function(e,t){if(!e)return R.error("The element is not exist."),!1;for(var n=e.className.split(/\s+/),r=0;r<n.length;r++)if(n[r]===t)return!0;return!1},exports.inRate=function(e){return P(e)},exports.invokeEvent=function(e){F(e)},exports.invokeFn=v,exports.isBrowser=function(){if(A)return"browser"===A;var e="undefined"!=typeof window;return e&&(A="browser"),e},exports.isHit=P,exports.isJSONString=c,exports.isJsonString=function(e){return c(e)},exports.isNonEmptyArray=h,exports.isNonEmptyObject=function(e){return!!w(e)&&0!==Object.keys(e).length},exports.isNumber=g,exports.isPureObject=w,exports.isSafePWAEnv=function(){if(Z)return"pwa"===Z;var e=V();return"serviceWorker"in navigator&&function(){var e;try{return e=new Function("return async function(){};")(),null!=Object.getPrototypeOf(e).constructor}catch(e){return!1}}()&&"undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]")&&Boolean(window.fetch)&&Boolean(window.indexedDB)&&Boolean(window.caches)&&!e.shell?(Z="pwa",!0):(Z="no-pwa",!1)},exports.isSupportWebp=function(){return W?Promise.resolve("webp"===W):new Promise((function(e){var t=new Image;t.onload=function(){var n=t.width>0&&t.height>0;W=n?"webp":"no-webp",e(n)},t.onerror=function(){W="no-webp",e(!1)},t.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="}))},exports.isSupportedEntryType=z,exports.isValidData=function(e,t,n){var r=!1;return"object"!=typeof e||t.reduce((function(e,t){return void 0===e[t]?Object.create(null):e=e[t]}),e)===n&&(r=!0),r},exports.isValidEmail=function(e){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},exports.isValidHttpUrl=M,exports.isValidPhoneNumber=function(e){return/^1\d{10}$/.test(e)},exports.isValidUrl=function(e){return/^[a-zA-Z0-9]+:\/\/[-a-zA-Z0-9@:%._+~#=]{1,256}\b([-a-zA-Z0-9\u4E00-\u9FA5()!@:%_+.~#?&//=]*)$/.test(e)},exports.loadCSS=function(e,t){void 0===t&&(t={id:""});var n,r=t.id,o=function(){},i=new Promise((function(e,t){var r;n=(r=[e,t])[0],o=r[1]})),a=function(){n("loaded")},s=document.createElement("link");s||o(new Error("Not support create link element"));var c="onload"in s,u=+navigator.userAgent.replace(/.*(?:AppleWebKit|AndroidWebKit)\/?(\d+).*/i,"$1")<536;if(s.rel="stylesheet",s.type="text/css",s.href=e,void 0!==r&&(s.id=r),document.getElementsByTagName("head")[0].appendChild(s),u||!c)return setTimeout((function(){f(s,a,0)}),1),i;function d(){s&&(s.onload=s.onerror=s.onreadystatechange=null),s=null,a()}function f(e,t,n){if(e){var r,o=e.sheet;if((n+=1)>3e5)return r=!0,e&&(e=null),void t();if(u)o&&(r=!0);else if(o)try{o.cssRules&&(r=!0)}catch(e){var i=e;if(!i.name)return;"NS_ERROR_DOM_SECURITY_ERR"===i.name&&(r=!0)}setTimeout((function(){r?t():f(e,t,n)}),20)}}return c?(s.onload=d,s.onerror=function(){d()}):s.onreadystatechange=function(){s&&/loaded|complete/.test(s.readyState)&&d()},i},exports.loadImage=function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e}))},exports.loadScript=D,exports.loadScriptIfUndefined=function(e,t){return window[e]?Promise.resolve("defined"):D(t)},exports.longestComSubsequence=O,exports.longestComSubstring=C,exports.mNow=l,exports.mTrim=function(e){for(var t=(e=e.replace(/^\s+/,"")).length-1,n=/\s/;n.test(e.charAt(t));)t--;return e.slice(0,t+1)},exports.mazeyCon=R,exports.newLine=function(e){return y(e)},exports.removeClass=function(e,t){var n;e?(n=(n=(n=(n=" "+e.className+" ").replace(/(\s+)/gi," ")).replace(" "+t+" "," ")).replace(/(^\s+)|(\s+$)/g,""),e.className=n):R.error("The element is not exist.")},exports.removeCookie=U,exports.removeEvent=function(e,t){var n=L(),r=n[e];if("string"==typeof e&&r instanceof Array)if("function"==typeof t){for(var o=0,i=r.length;o<i;o++)if(r[o]===t){n[e].splice(o,1);break}}else delete n[e]},exports.removeHTML=x,exports.removeHtml=function(e,t){return void 0===t&&(t={}),x(e,t)},exports.repeatUntilConditionMet=function(e,r,o){var i=this;void 0===r&&(r={}),void 0===o&&(o=function(e){return!0===e});var a=r.interval,s=void 0===a?1e3:a,c=r.times,u=void 0===c?10:c,d=r.context,f=r.args,l=0;"function"!=typeof e&&console.error("Expected a function."),("number"!=typeof s||s<0)&&console.error("Expected a non-negative number for interval."),("number"!=typeof u||u<0)&&console.error("Expected a non-negative number for times."),function r(){setTimeout((function(){return t(i,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return[4,e.apply(d,f)];case 1:return t=n.sent(),o(t)||++l>=u?[2]:(r(),[2])}}))}))}),s)}()},exports.replaceHttp=function(e){return k(e)},exports.sanitizeInput=function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};if("string"!=typeof e)throw new Error("Input must be a string");return e.replace(/[&<>"'/]/g,(function(e){return t[e]}))},exports.setClass=function(e,t){j(e,t)},exports.setCookie=function(e,t,n,r){var o,i;if(n){var a=new Date;a.setTime(a.getTime()+24*n*60*60*1e3),i="; expires="+a.toUTCString()}else i="";var s=location.host;1===s.split(".").length?document.cookie=e+"="+t+i+"; path=/":((o=s.split(".")).shift(),r=r||"."+o.join("."),document.cookie=e+"="+t+i+"; path=/; domain="+r,null!==I(e)&&I(e)===t||(r=r||"."+s,document.cookie=e+"="+t+i+"; path=/; domain="+r))},exports.setImgSizeBySrc=B,exports.setImgWidHeiBySrc=function(){return B()},exports.setLocalStorage=function(e,t){void 0===t&&(t=null),e&&localStorage.setItem(e,JSON.stringify(t))},exports.setSessionStorage=function(e,t){void 0===t&&(t=null),e&&sessionStorage.setItem(e,JSON.stringify(t))},exports.sleep=function(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,T(e)]}))}))},exports.throttle=function(e,t,n){void 0===n&&(n={}),n=Object.assign({},n);var r=null,o=null,i=null,a=[null,0],s=a[0],c=a[1],u=function(){c=!1===n.leading?0:l(),i=null,s=e.apply(this,o),i||(r=o=null)};return function(){for(var a=[],d=0;d<arguments.length;d++)a[d]=arguments[d];var f=l();c||!1!==n.leading||(c=f);var p=t-(f-c);return r=this,o=a,p<=0||p>t?(i&&(clearTimeout(i),i=null),c=f,s=e.apply(r,o),i||(r=o=null)):i||!1===n.trailing||(i=setTimeout(u.bind(r),p)),s}},exports.truncateZHString=E,exports.unsanitize=function(e){return b(e)},exports.unsanitizeInput=b,exports.updateQueryParam=function(e,t,n){if(e.includes("#")){var r=new URL(e);return r.searchParams.set(t,n),r.toString()}var o=new RegExp("([?&])"+t+"=.*?(&|$)","i"),i=-1!==e.indexOf("?")?"&":"?";return e.match(o)?e.replace(o,"$1"+t+"="+n+"$2"):e+i+t+"="+n},exports.waitTime=T,exports.windowLoaded=function(e){void 0===e&&(e=90);var t,n=function(){},r=new Promise((function(e,r){n=e,t=r}));return"complete"===document.readyState?n("complete"):window.addEventListener("load",(function(){return n("load")})),setTimeout((function(){return t(Error("timeout"))}),1e3*e),r},exports.zAxiosIsValidRes=function(e,t){void 0===t&&(t={validStatusRange:[200,300],validCode:[0]});var n=Object.assign({validStatusRange:[200,300],validCode:[0]},t),r=n.validStatusRange,o=n.validCode;2!==r.length&&console.error("valid validStatusRange is required");var i=!1;if(e&&e.status&&2===r.length&&e.status>=r[0]&&e.status<r[1]){var a=e.data;a&&o.includes(a.code)&&(i=!0)}return i};
|
|
6
|
+
"use strict";var e=function(){return e=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},e.apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function r(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 o(t){if("object"!=typeof t)return t;var n=["string","number","boolean","undefined"];return Object.values(t).every((function(e){return n.includes(typeof e)}))?e({},t):JSON.parse(JSON.stringify(t))}function i(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();return"-"===t[0]?t.substring(1):t}function a(e){var t=e.replace(/([A-Z])/g,"_$1").toLowerCase();return"_"===t[0]?t.substring(1):t}function s(e){return a(e)}function u(e){try{if("object"==typeof JSON.parse(e))return!0}catch(e){}return!1}function c(e){void 0===e&&(e=5);for(var t="";e--;)t+=Math.floor(10*Math.random());return t}function f(e){return void 0===e&&(e=5),c(e)}function d(e){void 0===e&&(e=3);var t=[l(),f(e||3)];return t[0]+t[1]}function l(){return Date.now?Date.now():(new Date).getTime()}"function"==typeof SuppressedError&&SuppressedError;var p={type:"d"};function g(e,t){void 0===t&&(t={});var n=t.isNaNAsNumber,r=void 0!==n&&n,o=t.isInfinityAsNumber,i=void 0!==o&&o,a=t.isUnFiniteAsNumber;return"number"==typeof e&&(!(!0!==i&&!0!==(void 0!==a&&a)&&!isFinite(e))&&!(!r&&isNaN(e)))}function v(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=null;return e&&"function"==typeof e&&(r=e.apply(void 0,t)),r}function m(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return v.apply(void 0,r([e],t,!1))}function h(e){var t=!1;return Array.isArray(e)&&e.length&&(t=!0),t}function w(e){var t=Boolean(e),n="object"==typeof e,r="[object Object]"===Object.prototype.toString.call(e);return t&&n&&r}function y(e){if(!e)return"";var t=new RegExp("\\n","g");return e.replace(t,"<br />")}function x(e,t){void 0===t&&(t={});var n=t.removeNewLine,r=void 0!==n&&n,o="";return e&&(o=e.replace(/<\/?.+?>/g,""),r&&(o=o.replace(/[\r\n]/g,""))),o}function b(e){var t={"&":"&","<":"<",">":">",""":'"',"'":"'","/":"/"};if("string"!=typeof e)throw new Error("Input must be a string");return e.replace(/(&|<|>|"|'|/)/g,(function(e){return t[e]}))}function S(e,t,n){if(void 0===n&&(n={hasDot:!1,dotText:"..."}),n=Object.assign({hasDot:!1,dotText:"..."},n),""!=e&&e){for(var r=0,o="",i=/[^\x00-\xff]/g,a="",s=e.replace(i,"**").length,u=0;u<s&&(null!=(a=e.charAt(u).toString()).match(i)?r+=2:r++,!(r>t));u++)o+=a;return n.hasDot&&s>t&&(o+=n.dotText),o}return""}function E(e,t,n){return void 0===n&&(n=!1),S(e,t,{hasDot:n})}function T(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,new Promise((function(t){setTimeout((function(){t(e)}),e)}))]}))}))}var A="";function O(e,t){for(var n=e.length,r=t.length,i=o(new Array(n).fill(new Array(r).fill(0))),a=0;a<n;++a)for(var s=0;s<r;++s)if(e[a]===t[s]){var u=0;a>0&&s>0&&(u=i[a-1][s-1]),i[a][s]=u+1}var c=Array.prototype.concat.apply([],i);return Math.max.apply(Math,c)}function C(e,t){for(var n=e.length,r=t.length,i=o(new Array(n).fill(new Array(r).fill(0))),a=0;a<n;++a)for(var s=0;s<r;++s)if(e[a]===t[s]){var u=0;a>0&&s>0&&(u=i[a-1][s-1]),i[a][s]=u+1}else{var c=[0,0],f=c[0],d=c[1];s>0&&(f=i[a][s-1]),a>0&&(d=i[a-1][s]),i[a][s]=Math.max(f,d)}var l=Array.prototype.concat.apply([],i);return Math.max.apply(Math,l)}function P(e){return Math.random()<e}function M(e,t){void 0===t&&(t={strict:!0});var n=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9\u4E00-\u9FA5()!@:%_+.~#?&//=]*)/;return t.strict||(n=/^(https?:)?\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9\u4E00-\u9FA5()!@:%_+.~#?&//=]*)/),n.test(e)}function k(e){return e.replace(/^http:/,"https:")}function N(e){void 0===e&&(e="");var t=window.URL;if(!t)return!1;if(!t.canParse)return!1;if("function"!=typeof t.canParse)return!1;try{var n=new t("b","http://a");return n.pathname="c d","http://a/c%20d"===n.href&&Boolean(n.searchParams)&&t.canParse(e)}catch(e){return!1}}function _(e,t){void 0===e&&(e=""),void 0===t&&(t={isClosed:!1,showWrap:!1,showDate:!1,locales:"en-US",logFn:function(){},errorFn:function(){}});var n=Object.assign({isClosed:!1,showWrap:!1,showDate:!1,locales:"en-US",logFn:function(){},errorFn:function(){}},t),o=n.isClosed,i=n.showWrap,a=n.showDate,s=n.locales,u=n.logFn,c=n.errorFn,f=Object.create(null),d=function(){return(new Date).toLocaleDateString(s,{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})};return["log","info","warn","error"].forEach((function(t){f[t]=function(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];if(o)return!1;var f=e,l=e;if("string"==typeof e&&e.length>=2){var p=e.length;f=":"===e[p-1]?e.substring(0,p-1):e}i&&console.log("--- ".concat(f," - begin ---")),a&&(l=e?"".concat(d()," ").concat(e):"".concat(d())),e||a?console[t].apply(console,r([l],n,!1)):console[t].apply(console,n),"log"===t&&u(),"error"===t&&c(),i&&console.log("--- ".concat(f," - end ---"))}})),f}var j=_("[Mazey]");function R(e,t){if(e)if(Array.isArray(t))t.forEach((function(t){e.classList.add(t)}));else{for(var n=e.className,r=n.split(/\s+/),o=0;o<r.length;o++)if(r[o]===t)return;var i,a="";""!==n&&(a=" "),i=n+a+t,e.className=i}else j.error("The element is not exist.")}function B(){var e,t=window.jQuery||window.$;return t?!(!(e=t("img"))||!e.length)&&(e.each((function(){var e=t(this);if(e){var n=e.attr("src");if(n&&"string"==typeof n&&n.length){var r=n.match(/width=([0-9]+[a-z%]*)/),o=n.match(/height=([0-9]+[a-z%]*)/);r&&h(r)&&r[1]&&e.width(r[1]),o&&h(o)&&o[1]&&e.height(o[1])}}})),!0):(e=document.getElementsByTagName("img")).length>0&&(Array.from(e).forEach((function(e){var t=e;if(t){var n=t.getAttribute("src");if(n&&"string"==typeof n&&n.length){var r=n.match(/width=([0-9]+[a-z%]*)/),o=n.match(/height=([0-9]+[a-z%]*)/);r&&h(r)&&r[1]&&(t.style.width=r[1]),o&&h(o)&&o[1]&&(t.style.height=o[1])}}})),!0)}function L(){var e=window.MAZEY_DEFINE_LISTENERS;return"object"!=typeof e&&(e={},window.MAZEY_DEFINE_LISTENERS=e),e}function F(t,n){void 0===n&&(n={});var r=L()[t];if(r instanceof Array)for(var o=0,i=r.length;o<i;o++)"function"==typeof r[o]&&r[o](e(e({},n),{type:t}))}function D(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}function U(e){for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var r=t[n].trim();if(r.startsWith("".concat(e,"="))){var o=r.split("=")[0],i=new Date;return i.setTime(i.getTime()-1),document.cookie="".concat(o,"=;expires=").concat(i.toUTCString()),!0}}return!1}function I(e,t){void 0===t&&(t={id:"",callback:function(){},timeout:5e3,isDefer:!1});var n,r,o=Object.assign({id:"",callback:function(){},timeout:5e3,isDefer:!1},t),i=o.id,a=o.callback,s=o.timeout,u=o.isDefer,c=document.createElement("script");c||Promise.reject("Not support create script element");var f=document.getElementsByTagName("script")[0];return c.type="text/javascript",u&&(c.defer=!0),i&&(c.id=i),c.readyState?c.onreadystatechange=function(){"loaded"!==c.readyState&&"complete"!==c.readyState||(c.onreadystatechange=null,m(a),m(n,"loaded"))}:c.onload=function(){m(a),m(n,"loaded")},c.src=e,f&&f.parentNode.insertBefore(c,f),new Promise((function(e,t){var o;n=(o=[e,t])[0],r=o[1],s&&setTimeout(r.bind(null,"timeout"),s)}))}function z(e){var t=[],n=window.PerformanceObserver;return!!n&&(h(n.supportedEntryTypes)&&(t=n.supportedEntryTypes),t.includes(e))}function q(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("paint")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"first-contentful-paint"===e.name}));r&&(t.disconnect(),e(Math.round(r.startTime)))}));t.observe({type:"paint",buffered:!0})}))]:[2,0]}))}))}function H(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("paint")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"first-paint"===e.name}));r&&(t.disconnect(),e(Math.round(r.startTime)))}));t.observe({type:"paint",buffered:!0})}))]:[2,0]}))}))}var Z="";function V(){if(window.MAZEY_BROWSER_INFO&&"object"==typeof window.MAZEY_BROWSER_INFO)return window.MAZEY_BROWSER_INFO;var t={engine:"",engineVs:"",platform:"",supporter:"",supporterVs:"",system:"",systemVs:"",shell:"",shellVs:"",appleType:""};try{var n=navigator.userAgent.toLowerCase();if(!n)return t;var r=function(e){return e.test(n)},o=function(e){var t="",r=n.match(e);return r&&h(r)&&(t=(t=(t=r.toString()).replace(/[^0-9|_.]/g,"")).replace(/_/g,".")),t},i="",a="";r(/windows|win32|win64|wow32|wow64/g)?i="windows":r(/macintosh|macintel/g)?i="macos":r(/x11/g)?i="linux":r(/android|adr/g)?i="android":r(/ios|iphone|ipad|ipod|iwatch/g)&&(i="ios",r(/ipad/g)?a="ipad":r(/iphone/g)?a="iphone":r(/iwatch/g)?a="iwatch":r(/ipod/g)&&(a="ipod")),t=e(e({},t),{system:i,appleType:a});var s="";"windows"===i?r(/windows nt 5.0|windows 2000/g)?s="2000":r(/windows nt 5.1|windows xp/g)?s="xp":r(/windows nt 5.2|windows 2003/g)?s="2003":r(/windows nt 6.0|windows vista/g)?s="vista":r(/windows nt 6.1|windows 7/g)?s="7":r(/windows nt 6.2|windows 8/g)?s="8":r(/windows nt 6.3|windows 8.1/g)?s="8.1":r(/windows nt 10.0|windows 10/g)&&(s="10"):"macos"===i?s=o(/os x [\d._]+/g):"android"===i?s=o(/android [\d._]+/g):"ios"===i&&(s=o(/os [\d._]+/g)),t=e(e({},t),{systemVs:s});var u="";"windows"===i||"macos"===i||"linux"===i?u="desktop":("android"===i||"ios"===i||r(/mobile/g))&&(u="mobile"),t=e(e({},t),{platform:u});var c="",f="";r(/applewebkit/g)?(c="webkit",r(/edge/g)?f="edge":r(/opr/g)?f="opera":r(/chrome/g)?f="chrome":r(/safari/g)&&(f="safari")):r(/gecko/g)&&r(/firefox/g)?(c="gecko",f="firefox"):r(/presto/g)?(c="presto",f="opera"):r(/trident|compatible|msie/g)&&(c="trident",f="iexplore"),t=e(e({},t),{engine:c,supporter:f});var d="";"webkit"===c?d=o(/applewebkit\/[\d._]+/g):"gecko"===c?d=o(/gecko\/[\d._]+/g):"presto"===c?d=o(/presto\/[\d._]+/g):"trident"===c&&(d=o(/trident\/[\d._]+/g)),t=e(e({},t),{engineVs:d});var l="";"chrome"===f?l=o(/chrome\/[\d._]+/g):"safari"===f?l=o(/version\/[\d._]+/g):"firefox"===f?l=o(/firefox\/[\d._]+/g):"opera"===f?l=o(/opr\/[\d._]+/g):"iexplore"===f?l=o(/(msie [\d._]+)|(rv:[\d._]+)/g):"edge"===f&&(l=o(/edge\/[\d._]+/g)),t=e(e({},t),{supporterVs:l});var p="",g="";return r(/micromessenger/g)?(p="wechat",g=o(/micromessenger\/[\d._]+/g)):r(/qqbrowser/g)?(p="qq_browser",g=o(/qqbrowser\/[\d._]+/g)):r(/\sqq/g)?p="qq_app":r(/ucbrowser/g)?(p="uc",g=o(/ucbrowser\/[\d._]+/g)):r(/qihu 360se/g)?p="360":r(/2345explorer/g)?(p="2345",g=o(/2345explorer\/[\d._]+/g)):r(/metasr/g)?p="sougou":r(/lbbrowser/g)?p="liebao":r(/maxthon/g)?(p="maxthon",g=o(/maxthon\/[\d._]+/g)):r(/biliapp/g)&&(p="bilibili"),t=e(e({},t),{shell:p,shellVs:g}),window.MAZEY_BROWSER_INFO=t,t}catch(e){return j.warn(e),t}}var W="";exports.addClass=R,exports.addEvent=function(e,t){var n=L();void 0===n[e]&&(n[e]=[]),"function"==typeof t&&n[e].push(t)},exports.addStyle=function(e,t){if(void 0===t&&(t={id:""}),!e)return!1;var n=document.createDocumentFragment(),r=null,o="",i=document.createElement("style");return t.id?(o="".concat(t.id),(r=document.getElementById(o))?r.innerHTML=e:(i.setAttribute("id",t.id),i.innerHTML=e,n.appendChild(i),document.head.appendChild(n))):(i.innerHTML=e,n.appendChild(i),document.head.appendChild(n)),!0},exports.calLongestCommonSubsequence=function(e,t){return C(e,t)},exports.calLongestCommonSubstring=function(e,t){return O(e,t)},exports.camelCase2Underscore=s,exports.camelCaseToKebabCase=function(e){return i(e)},exports.cancelBubble=function(e){var t=e||window.event;t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},exports.clearHTML=function(e,t){return void 0===t&&(t={}),x(e,t)},exports.clearHtml=function(e,t){return void 0===t&&(t={}),x(e,t)},exports.convert10To26=function(e){for(var t="";e>0;){var n=e%26;0===n&&(n=26),t=String.fromCharCode(n+96)+t,e=(e-n)/26}return t},exports.convertCamelToKebab=i,exports.convertCamelToUnder=a,exports.convertHttpToHttps=k,exports.convertKebabToCamel=function(e){var t=e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}));return t.endsWith("-")?t.slice(0,-1):t},exports.convertObjectToQuery=function(e){if(e&&0===Object.keys(e).length)return"";var t="?";for(var n in e)t+="".concat(n,"=").concat(e[n],"&");return t.slice(0,-1)},exports.convertToHtmlBreaks=y,exports.cutCHSString=function(e,t,n){return void 0===n&&(n=!1),E(e,t,n)},exports.cutZHString=S,exports.debounce=function(e,t,n){var r=null,o=null,i=null,a=null,s=null,u=function u(){var c=l()-i;c<t&&c>=0?o=setTimeout(u,t-c):(o=null,n||(s=e.apply(r,a),o||(r=a=null)))};return function(){for(var c=[],f=0;f<arguments.length;f++)c[f]=arguments[f];r=this,a=c,i=l();var d=n&&!o;return o||(o=setTimeout(u,t)),d&&(s=e.apply(r,a),r=a=null),s}},exports.deepCopy=o,exports.deepCopyObject=function(e){return o(e)},exports.delCookie=function(e){U(e)},exports.doFn=m,exports.fireEvent=F,exports.floatFixed=function(e,t){return void 0===t&&(t=0),parseFloat(e).toFixed(t)},exports.floatToPercent=function(e,t){void 0===t&&(t=0);var n="";return n=t?(100*e).toFixed(t):String(Math.floor(100*e)),"".concat(n,"%")},exports.formatDate=function(e,t){void 0===t&&(t="yyyy-MM-dd"),e||(e=new Date);var n=new Date(e),r=n.getHours(),o={yyyy:n.getFullYear(),MM:n.getMonth()+1,dd:n.getDate()<10?"0"+n.getDate():n.getDate(),HH:r<10?"0"+r:r,hh:(r%12||12)<10?"0"+(r%12||12):r%12||12,mm:n.getMinutes()<10?"0"+n.getMinutes():n.getMinutes(),ss:n.getSeconds()<10?"0"+n.getSeconds():n.getSeconds(),a:r<12?"AM":"PM"},i=t||"yyyy-MM-dd";return Object.keys(o).forEach((function(e){var t=o[e];"MM"===e&&Number(t)<=9&&(t="0".concat(t)),i=i.replace(e,String(t))})),i},exports.genBrowserAttrs=function(e,t){void 0===e&&(e=""),void 0===t&&(t="-");var n=V(),r=[];return["system","platform","engine","supporter","shell","appleType"].forEach((function(o){var i=n[o];if(i){var a="";e&&e.length>0&&(a="".concat(e).concat(t)),r.push("".concat(a).concat(i))}})),r},exports.genCustomConsole=_,exports.genHashCode=function(e){var t,n=0;for(t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return n},exports.genRndNumString=c,exports.genStyleString=function(e,t){var n="";return t&&t.length>0&&(n=t.join(";")+";"),"".concat(e,"{").concat(n,"}")},exports.genUniqueNumString=d,exports.generateRndNum=f,exports.generateUniqueNum=function(e){return void 0===e&&(e=3),d(e)},exports.getAllQueryParams=function(e){void 0===e&&(e=""),""===e&&(e=location.search);var t={};return e.replace(/\??(\w+)=([^&]*)&?/g,(function(e,n,r){return void 0===t[n]&&(t[n]=decodeURIComponent(r)),""})),t},exports.getBrowserInfo=V,exports.getCLS=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("layout-shift")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().reduce((function(e,t){var n=0;return g(t.value)&&(n=t.value),e+n}),0);t.disconnect(),e(r)}));t.observe({type:"layout-shift",buffered:!0})}))]:[2,0]}))}))},exports.getCookie=D,exports.getCurrentVersion=function(){return"v4"},exports.getDefineListeners=L,exports.getDomain=function(e,t){if(void 0===t&&(t=["hostname"]),N(e)){var n=new window.URL(e);return t.reduce((function(e,t){return e+=n[t]}),"")}var r=document.createElement("a");return r.href=e,t.reduce((function(e,t){return e+=r[t]}),"")},exports.getFCP=q,exports.getFID=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("first-input")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"first-input"===e.entryType}));if(r){t.disconnect();var o=r.processingStart;e(o?Math.round(r.processingStart-r.startTime):0)}}));t.observe({type:"first-input",buffered:!0})}))]:[2,0]}))}))},exports.getFP=H,exports.getFileSize=function(e){var t=function(e){return String(Math.ceil(e))};if(!e||e<0)return"";var n=1024;return e<n?e+" B":e<Math.pow(n,2)?t(e/n)+" KB":e<Math.pow(n,3)?t(e/Math.pow(n,2))+" MB":e<Math.pow(n,4)?t(e/Math.pow(n,3))+" G":t(e/Math.pow(n,4))+" T"},exports.getFriendlyInterval=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=p);var r=(n=Object.assign(p,n)).type,o=decodeURIComponent;g(e)||(e=new Date(e).getTime()),g(t)||(t=new Date(t).getTime());var i=Number(t)-Number(e),a="",s=new Array(4).fill(0),u=s[0],c=(s[1],s[2],s[3]),f=o("%20%E5%A4%A9%20"),d=o("%20%E6%97%B6%20"),l=o("%20%E5%88%86%20"),v=o("%20%E7%A7%92");if(i>=0)switch(u=Math.floor(i/1e3/60/60/24),Math.floor(i/1e3/60/60),Math.floor(i/1e3/60),c=Math.floor(i/1e3),r){case"d":a=u;break;case"text":a=(u=Math.floor(i/1e3/60/60/24))+f+Math.floor(i/1e3/60/60%24)+d+Math.floor(i/1e3/60%60)+l+(c=Math.floor(i/1e3%60))+v;break;default:a=c}return a},exports.getHashQueryParam=function(e){var t=location.hash.split("?");if(1===t.length)return"";var n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),r=t[1].match(n);return r?r[2]:""},exports.getLCP=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return z("largest-contentful-paint")?[2,new Promise((function(e){var t=new PerformanceObserver((function(n){var r=n.getEntries().find((function(e){return"largest-contentful-paint"===e.entryType}));r&&(t.disconnect(),e(Math.round(r.startTime)))}));t.observe({type:"largest-contentful-paint",buffered:!0})}))]:[2,0]}))}))},exports.getLocalStorage=function(e){var t=null;if(e){var n=localStorage.getItem(e);n&&(t=JSON.parse(n))}return t},exports.getPageMeta=function(e){var t;return document.querySelector&&(null===(t=document.querySelector('meta[name="'.concat(e,'"]')))||void 0===t?void 0:t.getAttribute("content"))||""},exports.getPerformance=function(e){return void 0===e&&(e=!1),t(this,void 0,void 0,(function(){function t(){var t={source:D,os:r(),osVersion:o(),deviceType:i(),network:a(),screenDirection:u(),unloadTime:w-y,redirectTime:x-b,dnsTime:S-E,tcpTime:T-A,sslTime:c(T,O),responseTime:C-P,downloadTime:M-C,firstPaintTime:Z,firstContentfulPaintTime:V,domReadyTime:k-U,onloadTime:N-U,whiteTime:C-U,renderTime:_-U,decodedBodySize:B,encodedBodySize:L};Object.keys(t).forEach((function(e){g(t[e])&&(t[e]<0?t[e]=0:t[e]=Math.round(t[e]))})),g(t.whiteTime)&&t.whiteTime>t.onloadTime&&(t.whiteTime=0);var n={};e||Object.keys(t).forEach((function(e){n[s(e)]=t[e]})),Object.keys(n).length?d(n):d(t)}function r(){return navigator.userAgent.indexOf("Android")>-1||navigator.userAgent.indexOf("Linux")>-1?"android":navigator.userAgent.indexOf("iPhone")>-1?"ios":navigator.userAgent.indexOf("Windows Phone")>-1?"wp":"others"}function o(){var e="",t=navigator.userAgent,n=t.indexOf("Android")>-1||t.indexOf("Linux")>-1,r=!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),o=navigator.userAgent.split(";");if(o.length<2)return e;var i=o[1];return i?(n&&(e=(i.match(/\d+\.\d+/g)||[])[0]),r&&(e=(i.match(/(\d+)_(\d+)_?(\d+)?/)||[])[0]),e||(e=""),e):e}function i(){var e,t=navigator.userAgent.toLowerCase(),n=t.match(/(ipad)/i)&&"ipad",r=t.match(/iphone os/i)&&"iphone os",o=t.match(/midp/i)&&"midp",i=t.match(/rv:1.2.3.4/i)&&"rv:1.2.3.4",a=t.match(/ucweb/i)&&"ucweb",s=t.match(/android/i)&&"android",u=t.match(/windows ce/i)&&"windows ce",c=t.match(/windows mobile/i)&&"windows mobile";return(e=n||r||o||i||a||s||u||c?r||o||i||a||s||u||c?"phone":n?"ipad":void 0:"pc")||(e=""),e}function a(){var e="",t=window.navigator;if(t.connection&&t.connection.effectiveType)switch(t.connection.effectiveType){case"wifi":e="wifi";break;case"4g":e="4g";break;case"2g":e="2g";break;case"3g":e="3g";break;case"ethernet":e="ethernet";break;case"default":e=void 0}return e||(e=""),e}function u(){var e="";return window.screen&&window.screen.orientation&&window.screen.orientation.angle&&(180!==window.screen.orientation.angle&&0!==window.screen.orientation.angle||(e="|"),90!==window.screen.orientation.angle&&-90!==window.screen.orientation.angle||(e="-")),e}function c(e,t){var n=0;return t&&(n=e-t),n}var f,d,l,p,v,m,w,y,x,b,S,E,T,A,O,C,P,M,k,N,_,j,R,B,L,F,D,U,I,Z,V;return n(this,(function(e){switch(e.label){case 0:if(!z("navigation"))return[2,Promise.reject(new Error("navigation is not supported"))];if(!(f=window.performance)||"function"!=typeof f.getEntries||"function"!=typeof f.getEntriesByType)return[2,Promise.reject(new Error("performance is not supported"))];if(l=new Promise((function(e){d=[e][0]})),p=null,h(v=f.getEntriesByType("navigation"))&&(p=v[0]),m=new Array(19).fill(0),w=m[0],y=m[1],x=m[2],b=m[3],S=m[4],E=m[5],T=m[6],A=m[7],O=m[8],C=m[9],P=m[10],M=m[11],k=m[12],N=m[13],_=m[14],j=m[15],R=m[16],B=m[17],L=m[18],F=f.timing,D="",p)D="PerformanceNavigationTiming",B=p.decodedBodySize,L=p.encodedBodySize,w=p.unloadEventEnd,y=p.unloadEventStart,x=p.redirectEnd,b=p.redirectStart,S=p.domainLookupEnd,E=p.domainLookupStart,T=p.connectEnd,A=p.connectStart,O=p.secureConnectionStart,C=p.responseStart,P=p.requestStart,M=p.responseEnd,k=p.domContentLoadedEventStart,N=p.loadEventStart,_=p.loadEventEnd,j=p.startTime,R=p.fetchStart;else{if(!F)return[2,Promise.reject(new Error("NavigationTiming and Timing are not supported"))];D="PerformanceTiming",w=F.unloadEventEnd,y=F.unloadEventStart,x=F.redirectEnd,b=F.redirectStart,S=F.domainLookupEnd,E=F.domainLookupStart,T=F.connectEnd,A=F.connectStart,O=F.secureConnectionStart,C=F.responseStart,P=F.requestStart,M=F.responseEnd,k=F.domContentLoadedEventStart,N=F.loadEventStart,_=F.loadEventEnd,j=F.navigationStart,R=F.fetchStart}if(U=0,g(j))U=j;else{if(!g(R))return[2,Promise.reject(new Error("startTime, navigationStart or fetchStart are required"))];U=R}return[4,Promise.all([H(),q()])];case 1:return I=e.sent(),Z=I[0],V=I[1],g(_)&&_>0?t():window.addEventListener("load",(function(){window.setTimeout((function(){t()}),0)})),[2,l]}}))}))},exports.getQueryParam=function(e){var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),n=location.search.substring(1).match(t);return null!==n?decodeURIComponent(n[2]):""},exports.getScriptQueryParam=function(e,t){void 0===t&&(t=""),t||(t=".js");for(var n=new RegExp("[?&]".concat(e,"=([^&]*)")),r=document.querySelectorAll('script[src*="'.concat(t,'"]')),o=0;o<r.length;o++){var i=r[o].getAttribute("src");if(i&&-1!==i.indexOf(t)){var a=i.match(n);if(a)return decodeURIComponent(a[1])}}return""},exports.getSessionStorage=function(e){var t=null;if(e){var n=sessionStorage.getItem(e);n&&(t=JSON.parse(n))}return t},exports.getTTFB=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){return z("navigation")&&window.performance&&window.performance.getEntriesByType?(e=performance.getEntriesByType("navigation")[0],0,e?(t=e.responseStart-e.requestStart,[2,Math.round(t)]):[2,0]):[2,0]}))}))},exports.getUrlFileType=function(e){var t="";if("string"!=typeof e||""==e)return t;var n=/\.[^/?#]+$/.exec(e);return n?(n[0].length>1&&(t=n[0].substring(1)),t):t},exports.getUrlHost=function(e){var t="";return!M(e)&&M(e,{strict:!1})&&0===e.indexOf("//")&&(e="https:"+e),N(e)&&(t=new URL(e).host),t},exports.getUrlParam=function(e,t,n){void 0===n&&(n={});var r=null;if(e.includes("#")){r=new URL(e).searchParams.getAll(t)}else{var o={};e.replace(/\??(\w+)=([^&]*)&?/g,(function(e,t,n){return void 0!==o[t]?o[t].push(n):o[t]=[n],""})),r=o[t]||[]}return n.returnArray?r:r.length?r[0]:null},exports.getUrlPath=function(e){var t="";return!M(e)&&M(e,{strict:!1})&&0===e.indexOf("//")&&(e="https:"+e),N(e)&&(t=new URL(e).pathname),t},exports.hasClass=function(e,t){if(!e)return j.error("The element is not exist."),!1;for(var n=e.className.split(/\s+/),r=0;r<n.length;r++)if(n[r]===t)return!0;return!1},exports.inRate=function(e){return P(e)},exports.invokeEvent=function(e){F(e)},exports.invokeFn=v,exports.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},exports.isBoolean=function(e){return"boolean"==typeof e},exports.isBrowser=function(){if(A)return"browser"===A;var e="undefined"!=typeof window;return e&&(A="browser"),e},exports.isFunction=function(e){return"function"==typeof e},exports.isHit=P,exports.isJSONString=u,exports.isJsonString=function(e){return u(e)},exports.isNonEmptyArray=h,exports.isNonEmptyObject=function(e){return!!w(e)&&0!==Object.keys(e).length},exports.isNumber=g,exports.isPureObject=w,exports.isSafePWAEnv=function(){if(Z)return"pwa"===Z;var e=V();return"serviceWorker"in navigator&&function(){var e;try{return e=new Function("return async function(){};")(),null!=Object.getPrototypeOf(e).constructor}catch(e){return!1}}()&&"undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]")&&Boolean(window.fetch)&&Boolean(window.indexedDB)&&Boolean(window.caches)&&!e.shell?(Z="pwa",!0):(Z="no-pwa",!1)},exports.isString=function(e){return"string"==typeof e},exports.isSupportWebp=function(){return W?Promise.resolve("webp"===W):new Promise((function(e){var t=new Image;t.onload=function(){var n=t.width>0&&t.height>0;W=n?"webp":"no-webp",e(n)},t.onerror=function(){W="no-webp",e(!1)},t.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="}))},exports.isSupportedEntryType=z,exports.isUdfOrNul=function(e){return null==e},exports.isValidData=function(e,t,n){var r=!1;return"object"!=typeof e||t.reduce((function(e,t){return void 0===e[t]?Object.create(null):e=e[t]}),e)===n&&(r=!0),r},exports.isValidEmail=function(e){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},exports.isValidHttpUrl=M,exports.isValidPhoneNumber=function(e){return/^1\d{10}$/.test(e)},exports.isValidUrl=function(e){return/^[a-zA-Z0-9]+:\/\/[-a-zA-Z0-9@:%._+~#=]{1,256}\b([-a-zA-Z0-9\u4E00-\u9FA5()!@:%_+.~#?&//=]*)$/.test(e)},exports.loadCSS=function(e,t){void 0===t&&(t={id:""});var n,r=t.id,o=function(){},i=new Promise((function(e,t){var r;n=(r=[e,t])[0],o=r[1]})),a=function(){n("loaded")},s=document.createElement("link");s||o(new Error("Not support create link element"));var u="onload"in s,c=+navigator.userAgent.replace(/.*(?:AppleWebKit|AndroidWebKit)\/?(\d+).*/i,"$1")<536;if(s.rel="stylesheet",s.type="text/css",s.href=e,void 0!==r&&(s.id=r),document.getElementsByTagName("head")[0].appendChild(s),c||!u)return setTimeout((function(){d(s,a,0)}),1),i;function f(){s&&(s.onload=s.onerror=s.onreadystatechange=null),s=null,a()}function d(e,t,n){if(e){var r,o=e.sheet;if((n+=1)>3e5)return r=!0,e&&(e=null),void t();if(c)o&&(r=!0);else if(o)try{o.cssRules&&(r=!0)}catch(e){var i=e;if(!i.name)return;"NS_ERROR_DOM_SECURITY_ERR"===i.name&&(r=!0)}setTimeout((function(){r?t():d(e,t,n)}),20)}}return u?(s.onload=f,s.onerror=function(){f()}):s.onreadystatechange=function(){s&&/loaded|complete/.test(s.readyState)&&f()},i},exports.loadImage=function(e){return new Promise((function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e}))},exports.loadScript=I,exports.loadScriptIfUndefined=function(e,t){return window[e]?Promise.resolve("defined"):I(t)},exports.longestComSubsequence=C,exports.longestComSubstring=O,exports.mNow=l,exports.mTrim=function(e){for(var t=(e=e.replace(/^\s+/,"")).length-1,n=/\s/;n.test(e.charAt(t));)t--;return e.slice(0,t+1)},exports.mazeyCon=j,exports.newLine=function(e){return y(e)},exports.removeClass=function(e,t){var n;e?(n=(n=(n=(n=" "+e.className+" ").replace(/(\s+)/gi," ")).replace(" "+t+" "," ")).replace(/(^\s+)|(\s+$)/g,""),e.className=n):j.error("The element is not exist.")},exports.removeCookie=U,exports.removeEvent=function(e,t){var n=L(),r=n[e];if("string"==typeof e&&r instanceof Array)if("function"==typeof t){for(var o=0,i=r.length;o<i;o++)if(r[o]===t){n[e].splice(o,1);break}}else delete n[e]},exports.removeHTML=x,exports.removeHtml=function(e,t){return void 0===t&&(t={}),x(e,t)},exports.repeatUntilConditionMet=function(e,r,o){var i=this;void 0===r&&(r={}),void 0===o&&(o=function(e){return!0===e});var a=r.interval,s=void 0===a?1e3:a,u=r.times,c=void 0===u?10:u,f=r.context,d=r.args,l=0;"function"!=typeof e&&console.error("Expected a function."),("number"!=typeof s||s<0)&&console.error("Expected a non-negative number for interval."),("number"!=typeof c||c<0)&&console.error("Expected a non-negative number for times."),function r(){setTimeout((function(){return t(i,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return[4,e.apply(f,d)];case 1:return t=n.sent(),o(t)||++l>=c?[2]:(r(),[2])}}))}))}),s)}()},exports.replaceHttp=function(e){return k(e)},exports.sanitizeInput=function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};if("string"!=typeof e)throw new Error("Input must be a string");return e.replace(/[&<>"'/]/g,(function(e){return t[e]}))},exports.setClass=function(e,t){R(e,t)},exports.setCookie=function(e,t,n,r){var o,i;if(n){var a=new Date;a.setTime(a.getTime()+24*n*60*60*1e3),i="; expires="+a.toUTCString()}else i="";var s=location.host;1===s.split(".").length?document.cookie=e+"="+t+i+"; path=/":((o=s.split(".")).shift(),r=r||"."+o.join("."),document.cookie=e+"="+t+i+"; path=/; domain="+r,null!==D(e)&&D(e)===t||(r=r||"."+s,document.cookie=e+"="+t+i+"; path=/; domain="+r))},exports.setImgSizeBySrc=B,exports.setImgWidHeiBySrc=function(){return B()},exports.setLocalStorage=function(e,t){void 0===t&&(t=null),e&&localStorage.setItem(e,JSON.stringify(t))},exports.setSessionStorage=function(e,t){void 0===t&&(t=null),e&&sessionStorage.setItem(e,JSON.stringify(t))},exports.sleep=function(e){return t(this,void 0,void 0,(function(){return n(this,(function(t){return[2,T(e)]}))}))},exports.throttle=function(e,t,n){void 0===n&&(n={}),n=Object.assign({},n);var r=null,o=null,i=null,a=[null,0],s=a[0],u=a[1],c=function(){u=!1===n.leading?0:l(),i=null,s=e.apply(this,o),i||(r=o=null)};return function(){for(var a=[],f=0;f<arguments.length;f++)a[f]=arguments[f];var d=l();u||!1!==n.leading||(u=d);var p=t-(d-u);return r=this,o=a,p<=0||p>t?(i&&(clearTimeout(i),i=null),u=d,s=e.apply(r,o),i||(r=o=null)):i||!1===n.trailing||(i=setTimeout(c.bind(r),p)),s}},exports.truncateZHString=E,exports.unsanitize=function(e){return b(e)},exports.unsanitizeInput=b,exports.updateQueryParam=function(e,t,n){if(e.includes("#")){var r=new URL(e);return r.searchParams.set(t,n),r.toString()}var o=new RegExp("([?&])"+t+"=.*?(&|$)","i"),i=-1!==e.indexOf("?")?"&":"?";return e.match(o)?e.replace(o,"$1"+t+"="+n+"$2"):e+i+t+"="+n},exports.waitTime=T,exports.windowLoaded=function(e){void 0===e&&(e=90);var t,n=function(){},r=new Promise((function(e,r){n=e,t=r}));return"complete"===document.readyState?n("complete"):window.addEventListener("load",(function(){return n("load")})),setTimeout((function(){return t(Error("timeout"))}),1e3*e),r},exports.zAxiosIsValidRes=function(e,t){void 0===t&&(t={validStatusRange:[200,300],validCode:[0]});var n=Object.assign({validStatusRange:[200,300],validCode:[0]},t),r=n.validStatusRange,o=n.validCode;2!==r.length&&console.error("valid validStatusRange is required");var i=!1;if(e&&e.status&&2===r.length&&e.status>=r[0]&&e.status<r[1]){var a=e.data;a&&o.includes(a.code)&&(i=!0)}return i};
|