sculp-js 1.13.1 → 1.13.3-beta.0

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.
Files changed (127) hide show
  1. package/README.md +10 -11
  2. package/dist/cjs/_virtual/_commonjsHelpers.js +13 -0
  3. package/{lib → dist}/cjs/array.js +1 -1
  4. package/{lib → dist}/cjs/async.js +1 -1
  5. package/{lib/cjs/we-decode.js → dist/cjs/base64.js} +53 -44
  6. package/{lib → dist}/cjs/clipboard.js +4 -2
  7. package/{lib → dist}/cjs/cloneDeep.js +1 -1
  8. package/{lib → dist}/cjs/cookie.js +1 -1
  9. package/{lib → dist}/cjs/date.js +1 -1
  10. package/{lib → dist}/cjs/dom.js +1 -1
  11. package/{lib → dist}/cjs/download.js +4 -2
  12. package/dist/cjs/easing.js +75 -0
  13. package/{lib → dist}/cjs/file.js +7 -3
  14. package/{lib → dist}/cjs/func.js +1 -1
  15. package/{lib → dist}/cjs/index.js +11 -8
  16. package/{lib → dist}/cjs/math.js +1 -1
  17. package/dist/cjs/node_modules/bezier-easing/src/index.js +123 -0
  18. package/{lib → dist}/cjs/number.js +1 -1
  19. package/{lib → dist}/cjs/object.js +1 -1
  20. package/{lib → dist}/cjs/path.js +1 -1
  21. package/{lib → dist}/cjs/qs.js +1 -1
  22. package/{lib → dist}/cjs/random.js +1 -1
  23. package/{lib → dist}/cjs/string.js +1 -1
  24. package/{lib → dist}/cjs/tooltip.js +5 -2
  25. package/{lib → dist}/cjs/tree.js +9 -23
  26. package/{lib → dist}/cjs/type.js +8 -1
  27. package/{lib → dist}/cjs/unique.js +1 -1
  28. package/{lib → dist}/cjs/url.js +1 -1
  29. package/{lib → dist}/cjs/validator.js +1 -1
  30. package/{lib → dist}/cjs/variable.js +1 -1
  31. package/{lib → dist}/cjs/watermark.js +4 -2
  32. package/{lib/es → dist/esm}/array.js +1 -1
  33. package/{lib/es → dist/esm}/async.js +1 -1
  34. package/{lib/es/we-decode.js → dist/esm/base64.js} +52 -45
  35. package/{lib/es → dist/esm}/clipboard.js +4 -2
  36. package/{lib/es → dist/esm}/cloneDeep.js +1 -1
  37. package/{lib/es → dist/esm}/cookie.js +1 -1
  38. package/{lib/es → dist/esm}/date.js +1 -1
  39. package/{lib/es → dist/esm}/dom.js +1 -1
  40. package/{lib/es → dist/esm}/download.js +4 -2
  41. package/{lib/es → dist/esm}/easing.js +34 -2
  42. package/{lib/es → dist/esm}/file.js +7 -3
  43. package/{lib/es → dist/esm}/func.js +1 -1
  44. package/{lib/es → dist/esm}/index.js +4 -5
  45. package/{lib/es → dist/esm}/math.js +1 -1
  46. package/{lib/es → dist/esm}/number.js +1 -1
  47. package/{lib/es → dist/esm}/object.js +1 -1
  48. package/{lib/es → dist/esm}/path.js +1 -1
  49. package/{lib/es → dist/esm}/qs.js +1 -1
  50. package/{lib/es → dist/esm}/random.js +1 -1
  51. package/{lib/es → dist/esm}/string.js +1 -1
  52. package/{lib/es → dist/esm}/tooltip.js +5 -2
  53. package/{lib/es → dist/esm}/tree.js +10 -24
  54. package/{lib/es → dist/esm}/type.js +8 -2
  55. package/{lib/es → dist/esm}/unique.js +1 -1
  56. package/{lib/es → dist/esm}/url.js +1 -1
  57. package/{lib/es → dist/esm}/validator.js +1 -1
  58. package/{lib/es → dist/esm}/variable.js +1 -1
  59. package/{lib/es → dist/esm}/watermark.js +4 -2
  60. package/dist/types/array.d.ts +50 -0
  61. package/dist/types/array.d.ts.map +1 -0
  62. package/dist/types/async.d.ts +37 -0
  63. package/dist/types/async.d.ts.map +1 -0
  64. package/dist/types/base64.d.ts +25 -0
  65. package/dist/types/base64.d.ts.map +1 -0
  66. package/dist/types/clipboard.d.ts +20 -0
  67. package/dist/types/clipboard.d.ts.map +1 -0
  68. package/dist/types/cloneDeep.d.ts +12 -0
  69. package/dist/types/cloneDeep.d.ts.map +1 -0
  70. package/dist/types/cookie.d.ts +19 -0
  71. package/dist/types/cookie.d.ts.map +1 -0
  72. package/dist/types/core-index.d.ts +17 -0
  73. package/dist/types/core-index.d.ts.map +1 -0
  74. package/dist/types/date.d.ts +74 -0
  75. package/dist/types/date.d.ts.map +1 -0
  76. package/dist/types/dom.d.ts +74 -0
  77. package/dist/types/dom.d.ts.map +1 -0
  78. package/dist/types/download.d.ts +47 -0
  79. package/dist/types/download.d.ts.map +1 -0
  80. package/dist/types/easing.d.ts +32 -0
  81. package/dist/types/easing.d.ts.map +1 -0
  82. package/dist/types/file.d.ts +44 -0
  83. package/dist/types/file.d.ts.map +1 -0
  84. package/dist/types/func.d.ts +50 -0
  85. package/dist/types/func.d.ts.map +1 -0
  86. package/dist/types/index.d.ts +28 -0
  87. package/dist/types/index.d.ts.map +1 -0
  88. package/dist/types/index.js +3278 -0
  89. package/dist/types/math.d.ts +36 -0
  90. package/dist/types/math.d.ts.map +1 -0
  91. package/dist/types/number.d.ts +49 -0
  92. package/dist/types/number.d.ts.map +1 -0
  93. package/dist/types/object.d.ts +70 -0
  94. package/dist/types/object.d.ts.map +1 -0
  95. package/dist/types/path.d.ts +14 -0
  96. package/dist/types/path.d.ts.map +1 -0
  97. package/dist/types/qs.d.ts +22 -0
  98. package/dist/types/qs.d.ts.map +1 -0
  99. package/dist/types/random.d.ts +27 -0
  100. package/dist/types/random.d.ts.map +1 -0
  101. package/dist/types/string.d.ts +67 -0
  102. package/dist/types/string.d.ts.map +1 -0
  103. package/dist/types/tooltip.d.ts +36 -0
  104. package/dist/types/tooltip.d.ts.map +1 -0
  105. package/dist/types/tree.d.ts +99 -0
  106. package/dist/types/tree.d.ts.map +1 -0
  107. package/dist/types/type.d.ts +128 -0
  108. package/dist/types/type.d.ts.map +1 -0
  109. package/dist/types/unique.d.ts +21 -0
  110. package/dist/types/unique.d.ts.map +1 -0
  111. package/dist/types/url.d.ts +46 -0
  112. package/dist/types/url.d.ts.map +1 -0
  113. package/dist/types/validator.d.ts +67 -0
  114. package/dist/types/validator.d.ts.map +1 -0
  115. package/dist/types/variable.d.ts +71 -0
  116. package/dist/types/variable.d.ts.map +1 -0
  117. package/dist/types/watermark.d.ts +19 -0
  118. package/dist/types/watermark.d.ts.map +1 -0
  119. package/dist/umd/index.min.js +6 -0
  120. package/package.json +234 -17
  121. package/lib/cjs/base64.js +0 -62
  122. package/lib/cjs/easing.js +0 -40
  123. package/lib/cjs/isEqual.js +0 -133
  124. package/lib/es/base64.js +0 -59
  125. package/lib/es/isEqual.js +0 -131
  126. package/lib/index.d.ts +0 -1214
  127. package/lib/umd/index.js +0 -6
@@ -0,0 +1,46 @@
1
+ import { AnyObject } from './type';
2
+ import { Params } from './qs';
3
+ export interface Url {
4
+ protocol: string;
5
+ auth: string;
6
+ username: string;
7
+ password: string;
8
+ host: string;
9
+ port: string;
10
+ hostname: string;
11
+ hash: string;
12
+ search: string;
13
+ searchParams: Params;
14
+ query: string;
15
+ pathname: string;
16
+ path: string;
17
+ href: string;
18
+ }
19
+ /**
20
+ * url 解析
21
+ * @param {string} url
22
+ * @param {boolean} isModernApi 使用现代API:URL, 默认true (对无效url解析会抛错), 否则使用a标签来解析(兼容性更强)
23
+ * @returns {Url}
24
+ */
25
+ export declare const urlParse: (url: string, isModernApi?: boolean) => Url;
26
+ /**
27
+ * url 字符化,url 对象里的 searchParams 会覆盖 url 原有的查询参数
28
+ * @param {Url} url
29
+ * @returns {string}
30
+ */
31
+ export declare const urlStringify: (url: Url) => string;
32
+ /**
33
+ * 设置 url 查询参数
34
+ * @param {string} url
35
+ * @param {AnyObject} setter
36
+ * @returns {string}
37
+ */
38
+ export declare const urlSetParams: (url: string, setter: AnyObject) => string;
39
+ /**
40
+ * 删除 url 查询参数
41
+ * @param {string} url
42
+ * @param {string[]} removeKeys
43
+ * @returns {string}
44
+ */
45
+ export declare const urlDelParams: (url: string, removeKeys: string[]) => string;
46
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,MAAM,QAAQ,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAsE,MAAM,MAAM,CAAC;AAElG,MAAM,WAAW,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,QAAS,MAAM,gBAAe,OAAO,KAAU,GAmCnE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAS,GAAG,KAAG,MASvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,UAAU,SAAS,KAAG,MAI7D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAS,MAAM,cAAc,MAAM,EAAE,KAAG,MAIhE,CAAC"}
@@ -0,0 +1,67 @@
1
+ export declare const EMAIL_REGEX: RegExp;
2
+ /**
3
+ * 判断字符串是否为邮箱格式,不对邮箱真实性做验证,如域名是否正确等
4
+ * @param {string} value
5
+ * @returns {boolean}
6
+ */
7
+ export declare const isEmail: (value: string) => boolean;
8
+ export declare const PHONE_REGEX: RegExp;
9
+ /**
10
+ * 判断字符串是否为宽松手机格式,即首位为 1 的 11 位数字都属于手机号
11
+ * @param {string} value
12
+ * @returns {boolean}
13
+ */
14
+ export declare const isPhone: (value: string) => boolean;
15
+ /**
16
+ * 判断字符串是否为身份证号码格式
17
+ * @param {string} value
18
+ * @returns {boolean}
19
+ */
20
+ export declare const isIdNo: (value: string) => boolean;
21
+ export declare const URL_REGEX: RegExp;
22
+ export declare const HTTP_URL_REGEX: RegExp;
23
+ /**
24
+ * 判断字符串是否为 url 格式,支持 http、https、ftp 协议,支持域名或者 ipV4
25
+ * @param {string} value
26
+ * @returns {boolean}
27
+ */
28
+ export declare const isUrl: (url: string, includeFtp?: boolean) => boolean;
29
+ export declare const IPV4_REGEX: RegExp;
30
+ export declare const IPV6_REGEX: RegExp;
31
+ /**
32
+ * 判断字符串是否为 IPV4 格式,不对 ip 真实性做验证
33
+ * @param {string} value
34
+ * @returns {boolean}
35
+ */
36
+ export declare const isIpV4: (value: string) => boolean;
37
+ /**
38
+ * 判断字符串是否为 IPV6 格式,不对 ip 真实性做验证
39
+ * @param {string} value
40
+ * @returns {boolean}
41
+ */
42
+ export declare const isIpV6: (value: string) => boolean;
43
+ /**
44
+ * 判断字符串是否为整数(自然数),即 ...,-3,-2,-1,0,1,2,3,...
45
+ * @param {string} value
46
+ * @returns {boolean}
47
+ */
48
+ export declare const isInteger: (value: string) => boolean;
49
+ /**
50
+ * 判断字符串是否为浮点数,即必须有小数点的有理数
51
+ * @param {string} value
52
+ * @returns {boolean}
53
+ */
54
+ export declare const isFloat: (value: string) => boolean;
55
+ /**
56
+ * 判断字符串是否为正确数值,包括整数和浮点数
57
+ * @param {string} value
58
+ * @returns {boolean}
59
+ */
60
+ export declare const isNumerical: (value: string) => boolean;
61
+ /**
62
+ * 判断字符串是否为数字,例如六位数字短信验证码(093031)
63
+ * @param {string} value
64
+ * @returns {boolean}
65
+ */
66
+ export declare const isDigit: (value: string) => boolean;
67
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/validator.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,QAAqD,CAAC;AAC9E;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,OAAkC,CAAC;AAI3E,eAAO,MAAM,WAAW,QAA8B,CAAC;AACvD;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,OAAkC,CAAC;AAuB3E;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,OA6BtC,CAAC;AAEF,eAAO,MAAM,SAAS,QAA4C,CAAC;AACnE,eAAO,MAAM,cAAc,QAAsC,CAAC;AAClE;;;;GAIG;AACH,eAAO,MAAM,KAAK,QAAS,MAAM,eAAc,OAAO,KAAW,OAGhE,CAAC;AAGF,eAAO,MAAM,UAAU,QAA0F,CAAC;AAElH,eAAO,MAAM,UAAU,QACuiB,CAAC;AAC/jB;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,OAAiC,CAAC;AACzE;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,OAAiC,CAAC;AAGzE;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,OAAiC,CAAC;AAG5E;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,OAA+B,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAAW,MAAM,KAAG,OAA6C,CAAC;AAG1F;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,MAAM,KAAG,OAA+B,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * 去除字符串中重复字符
3
+ * @param {string} str
4
+ * @returns string
5
+ * @example
6
+ *
7
+ * uniqueSymbol('1a1bac');
8
+ * // => '1abc'
9
+ */
10
+ export declare function uniqueSymbol(str: string): string;
11
+ /**
12
+ * 转义所有特殊字符
13
+ * @param {string} str 原字符串
14
+ * reference: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_expressions
15
+ * @returns string
16
+ */
17
+ export declare function escapeRegExp(str: string): string;
18
+ /**
19
+ * 解析字符串的插值变量
20
+ * @param {string} str 字符串
21
+ * @param {string} leftMatchSymbol 变量左侧匹配符号,默认:{
22
+ * @param {string} rightMatchSymbol 变量右侧匹配符号,默认:}
23
+ * @returns string[]
24
+ * @example
25
+ *
26
+ * default match symbol {} same as /{\s*([^{}\s]*)\s*}/g
27
+ */
28
+ export declare function parseVarFromString(str: string, leftMatchSymbol?: string, rightMatchSymbol?: string): string[];
29
+ /**
30
+ * 替换字符串中的插值变量
31
+ * @param {string} sourceStr
32
+ * @param {Record<string, any>} targetObj
33
+ * @param {string} leftMatchSymbol 变量左侧匹配符号,默认:{
34
+ * @param {string} rightMatchSymbol 变量右侧匹配符号,默认:}
35
+ * @returns string
36
+ */
37
+ export declare function replaceVarFromString(sourceStr: string, targetObj: Record<string, any>, leftMatchSymbol?: string, rightMatchSymbol?: string): string;
38
+ /**
39
+ * 在指定作用域中执行代码
40
+ * @param {string} code 要执行的代码(需包含 return 语句或表达式)
41
+ * @param {Object} scope 作用域对象(键值对形式的变量环境)
42
+ * @returns 代码执行结果
43
+ *
44
+ * @example
45
+ * // 测试用例 1: 基本变量访问
46
+ * executeInScope("return a + b;", { a: 1, b: 2 });
47
+ * // 3
48
+ *
49
+ * // 测试用例 2: 支持复杂表达式和运算
50
+ * executeInScope(
51
+ * "return Array.from({ length: 3 }, (_, i) => base + i);",
52
+ * { base: 100 }
53
+ * );
54
+ * // [100, 101, 102]
55
+ *
56
+ * // 支持外传函数作用域执行
57
+ * const scope = {
58
+ * $: {
59
+ * fun: {
60
+ * time: {
61
+ * now: function () {
62
+ * return new Date();
63
+ * },
64
+ * },
65
+ * },
66
+ * },
67
+ * };
68
+ * executeInScope("return $.fun.time.now()", scope)
69
+ */
70
+ export declare function executeInScope(code: string, scope?: Record<string, any>): any;
71
+ //# sourceMappingURL=variable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../src/variable.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AACD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,UAEvC;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,eAAe,GAAE,MAAY,EAC7B,gBAAgB,GAAE,MAAY,GAC7B,MAAM,EAAE,CAKV;AACD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,eAAe,GAAE,MAAY,EAC7B,gBAAgB,GAAE,MAAY,GAC7B,MAAM,CAIR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,OAa3E"}
@@ -0,0 +1,19 @@
1
+ export interface ICanvasWM {
2
+ rootContainer?: HTMLElement | string;
3
+ width?: string;
4
+ height?: string;
5
+ textAlign?: CanvasTextAlign;
6
+ textBaseline?: CanvasTextBaseline;
7
+ font?: string;
8
+ fillStyle?: string;
9
+ rotate?: number;
10
+ zIndex?: number;
11
+ watermarkId?: string;
12
+ }
13
+ /**
14
+ * canvas 实现 水印, 具备防删除功能
15
+ * @param {ICanvasWM} canvasWM
16
+ * @example genCanvasWM({ content: 'QQMusicFE' })
17
+ */
18
+ export declare function genCanvasWM(content?: string, canvasWM?: ICanvasWM): void;
19
+ //# sourceMappingURL=watermark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watermark.d.ts","sourceRoot":"","sources":["../../src/watermark.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACxB,aAAa,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAS,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,IAAI,CAqFxE"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * sculp-js v1.13.3-beta.0
3
+ * (c) 2023-present chandq
4
+ * Released under the MIT License.
5
+ */
6
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).sculpJs={})}(this,(function(e){"use strict";function t(e,t,n=!1){if(n)for(let n=e.length-1;n>=0;n--){const r=t(e[n],n,e);if(!1===r)break}else for(let n=0,r=e.length;n<r;n++){const r=t(e[n],n,e);if(!1===r)break}e=null}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r=.1,o="function"==typeof Float32Array;function i(e,t){return 1-3*t+3*e}function s(e,t){return 3*t-6*e}function a(e){return 3*e}function l(e,t,n){return((i(t,n)*e+s(t,n))*e+a(t))*e}function c(e,t,n){return 3*i(t,n)*e*e+2*s(t,n)*e+a(t)}function u(e){return e}var d=n((function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return u;for(var s=o?new Float32Array(11):new Array(11),a=0;a<11;++a)s[a]=l(a*r,e,n);function d(t){for(var o=0,i=1;10!==i&&s[i]<=t;++i)o+=r;--i;var a=o+(t-s[i])/(s[i+1]-s[i])*r,u=c(a,e,n);return u>=.001?function(e,t,n,r){for(var o=0;o<4;++o){var i=c(t,n,r);if(0===i)return t;t-=(l(t,n,r)-e)/i}return t}(t,a,e,n):0===u?a:function(e,t,n,r,o){var i,s,a=0;do{(i=l(s=t+(n-t)/2,r,o)-e)>0?n=s:t=s}while(Math.abs(i)>1e-7&&++a<10);return s}(t,o,o+r,e,n)}return function(e){return 0===e?0:1===e?1:l(d(e),t,i)}}));const{toString:f,hasOwnProperty:h,propertyIsEnumerable:p}=Object.prototype;function g(e,t){return h.call(e,t)}function m(e){return!!F(e)||(!!b(e)||!!v(e)&&g(e,"length"))}function y(e){return f.call(e).slice(8,-1)}const b=e=>"string"==typeof e,w=e=>"boolean"==typeof e,x=e=>"number"==typeof e&&!Number.isNaN(e),S=e=>void 0===e,A=e=>null===e;function E(e){return S(e)||A(e)}const v=e=>"Object"===y(e),F=e=>Array.isArray(e),C=e=>"function"==typeof e,$=e=>Number.isNaN(e),T=e=>"Date"===y(e);function R(e){if(E(e)||Number.isNaN(e))return!0;const t=y(e);return m(e)||"Arguments"===t?!e.length:"Set"===t||"Map"===t?!e.size:!Object.keys(e).length}function N(e){return!S(NodeList)&&NodeList.prototype.isPrototypeOf(e)}const I={linear:[0,0,1,1],ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]};function j(e){let t;if(F(e))t=d(...e);else{const n=I[e];if(!n)throw new Error(`${e} 缓冲函数未定义`);t=d(...n)}return e=>t(Math.max(0,Math.min(e,1)))}const D=e=>{if(!v(e))return!1;const t=Object.getPrototypeOf(e);return!t||t===Object.prototype};function P(e,t){for(const n in e)if(g(e,n)&&!1===t(e[n],n))break;e=null}function k(e,t){const n={};return P(e,((e,r)=>{t.includes(r)||(n[r]=e)})),e=null,n}const M=(e,t,n)=>{if(S(n))return t;if(y(t)!==y(n))return F(n)?M(e,[],n):v(n)?M(e,{},n):n;if(D(n)){const r=e.get(n);return r||(e.set(n,t),P(n,((n,r)=>{t[r]=M(e,t[r],n)})),t)}if(F(n)){const r=e.get(n);return r||(e.set(n,t),n.forEach(((n,r)=>{t[r]=M(e,t[r],n)})),t)}return n};function O(e,...t){const n=new Map;for(let r=0,o=t.length;r<o;r++){const o=t[r];e=M(n,e,o)}return n.clear(),e}function L(e,t="-"){return e.replace(/^./,(e=>e.toLowerCase())).replace(/[A-Z]/g,(e=>`${t}${e.toLowerCase()}`))}const B="0123456789",U="abcdefghijklmnopqrstuvwxyz",H="ABCDEFGHIJKLMNOPQRSTUVWXYZ",z=/%[%sdo]/g;const W=/\${(.*?)}/g;const q=(e,t)=>{e.split(/\s+/g).forEach(t)};const _=(e,t,n)=>{v(t)?P(t,((t,n)=>{_(e,n,t)})):e.style.setProperty(L(t),n)};function G(e,t=14,n=!0){let r=0;if(console.assert(b(e),`${e} 不是有效的字符串`),b(e)&&e.length>0){const o="getStrWidth1494304949567";let i=document.querySelector(`#${o}`);if(!i){const n=document.createElement("span");n.id=o,n.style.fontSize=t+"px",n.style.whiteSpace="nowrap",n.style.visibility="hidden",n.style.position="absolute",n.style.top="-9999px",n.style.left="-9999px",n.textContent=e,document.body.appendChild(n),i=n}i.textContent=e,r=i.offsetWidth,n&&i.remove()}return r}function Y(e){let t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName){const n=e.hasAttribute("readonly");n||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),n||e.removeAttribute("readonly"),t=e.value}else{e.hasAttribute("contenteditable")&&e.focus();const n=window.getSelection(),r=document.createRange();r.selectNodeContents(e),n.removeAllRanges(),n.addRange(r),t=n.toString()}return t}function V(e,t){const{successCallback:n,failCallback:r,container:o=document.body}=E(t)?{}:t;let i=function(e){const t="rtl"===document.documentElement.getAttribute("dir"),n=document.createElement("textarea");n.style.fontSize="12pt",n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[t?"right":"left"]="-9999px";const r=window.pageYOffset||document.documentElement.scrollTop;return n.style.top=`${r}px`,n.setAttribute("readonly",""),n.value=e,n}(e);o.appendChild(i),Y(i);try{document.execCommand("copy")&&C(n)&&n()}catch(e){C(r)&&r(e)}finally{o.removeChild(i),i=null,window.getSelection()?.removeAllRanges()}}function X(e,t,n){const r=[],o="expires";if(r.push([e,encodeURIComponent(t)]),x(n)){const e=new Date;e.setTime(e.getTime()+n),r.push([o,e.toUTCString()])}else T(n)&&r.push([o,n.toUTCString()]);r.push(["path","/"]),document.cookie=r.map((e=>{const[t,n]=e;return`${t}=${n}`})).join(";")}const J=e=>T(e)&&!$(e.getTime()),K=e=>{if(!b(e))return;const t=e.replace(/-/g,"/");return new Date(t)},Z=e=>{if(!b(e))return;const t=/([+-])(\d\d)(\d\d)$/,n=t.exec(e);if(!n)return;const r=e.replace(t,"Z"),o=new Date(r);if(!J(o))return;const[,i,s,a]=n,l=parseInt(s,10),c=parseInt(a,10),u=(e,t)=>"+"===i?e-t:e+t;return o.setHours(u(o.getHours(),l)),o.setMinutes(u(o.getMinutes(),c)),o};function Q(e){const t=new Date(e);if(J(t))return t;const n=K(e);if(J(n))return n;const r=Z(e);if(J(r))return r;throw new SyntaxError(`${e.toString()} 不是一个合法的日期描述`)}function ee(e){const t=Q(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)}const te=e=>{const t=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/\.{3,}/g,"..").replace(/\/\.\//g,"/").split("/").map((e=>e.trim())),n=e=>".."===e,r=[];let o=!1;const i=e=>{r.push(e)};return t.forEach((e=>{const t=(e=>"."===e)(e),s=n(e);return o?t?void 0:s?(()=>{if(0===r.length)return;const e=r[r.length-1];n(e)?r.push(".."):r.pop()})():void i(e):(i(e),void(o=!t&&!s))})),r.join("/")},ne=(e,...t)=>te([e,...t].join("/"));function re(e){const t=new URLSearchParams(e),n={};for(const[e,r]of t.entries())S(n[e])?n[e]=r:F(n[e])||(n[e]=t.getAll(e));return n}const oe=e=>b(e)?e:x(e)?String(e):w(e)?e?"true":"false":T(e)?e.toISOString():null;function ie(e,t=oe){const n=new URLSearchParams;return P(e,((e,r)=>{if(F(e))e.forEach((e=>{const o=t(e);null!==o&&n.append(r.toString(),o)}));else{const o=t(e);if(null===o)return;n.set(r.toString(),o)}})),n.toString()}const se=(e,t=!0)=>{let n=null;C(URL)&&t?n=new URL(e):(n=document.createElement("a"),n.href=e);const{protocol:r,username:o,password:i,host:s,port:a,hostname:l,hash:c,search:u,pathname:d}=n,f=ne("/",d),h=o&&i?`${o}:${i}`:"",p=u.replace(/^\?/,"");return n=null,{protocol:r,auth:h,username:o,password:i,host:s,port:a,hostname:l,hash:c,search:u,searchParams:re(p),query:p,pathname:f,path:`${f}${u}`,href:e}},ae=e=>{const{protocol:t,auth:n,host:r,pathname:o,searchParams:i,hash:s}=e,a=n?`${n}@`:"",l=ie(i),c=l?`?${l}`:"";let u=s.replace(/^#/,"");return u=u?"#"+u:"",`${t}//${a}${r}${o}${c}${u}`},le=(e,t)=>{const n=se(e);return Object.assign(n.searchParams,t),ae(n)};function ce(e,t,n){let r=document.createElement("a");r.download=t,r.style.display="none",r.href=e,document.body.appendChild(r),r.click(),setTimeout((()=>{document.body.removeChild(r),r=null,C(n)&&n()}))}function ue(e,t,n){const r=URL.createObjectURL(e);ce(r,t),setTimeout((()=>{URL.revokeObjectURL(r),C(n)&&n()}))}function de(){return!!document.createElement("canvas").getContext}function fe({maxWidth:e,maxHeight:t,originWidth:n,originHeight:r}){let o=n,i=r;return(n>e||r>t)&&(n/r>e/t?(o=e,i=Math.round(e*(r/n))):(i=t,o=Math.round(t*(n/r)))),{width:o,height:i}}function he(e){return"undefined"!=typeof globalThis?globalThis[e]:"undefined"!=typeof window?window[e]:"undefined"!=typeof global?global[e]:"undefined"!=typeof self?self[e]:void 0}const pe=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),ge=`${B}${H}${U}`;const me=`${B}${H}${U}`,ye="undefined"!=typeof BigInt,be=()=>he("JSBI"),we=e=>ye?BigInt(e):be().BigInt(e);function xe(e,t=me){if(t.length<2)throw new Error("进制池长度不能少于 2");if(!ye)throw new Error('需要安装 jsbi 模块并将 JSBI 设置为全局变量:\nimport JSBI from "jsbi"; window.JSBI = JSBI;');let n=we(e);const r=[],{length:o}=t,i=we(o),s=()=>{const e=Number(((e,t)=>ye?e%t:be().remainder(e,t))(n,i));n=((e,t)=>ye?e/t:be().divide(e,t))(n,i),r.unshift(t[e]),n>0&&s()};return s(),r.join("")}const Se=(e,t,n={ratio:1e3,decimals:0,separator:" "})=>{const{ratio:r=1e3,decimals:o=0,separator:i=" "}=n,{length:s}=t;if(0===s)throw new Error("At least one unit is required");let a=Number(e),l=0;for(;a>=r&&l<s-1;)a/=r,l++;const c=a.toFixed(o),u=t[l];return String(c)+i+u};function Ae(e,t){if(E(t))return parseInt(String(e)).toLocaleString();let n=0;if(!x(t))throw new Error("Decimals must be a positive number not less than zero");return t>0&&(n=t),Number(Number(e).toFixed(n)).toLocaleString("en-US")}let Ee=0,ve=0;const Fe=(e=18)=>{const t=Date.now();e=Math.max(e,18),t!==ve&&(ve=t,Ee=0);const n=`${t}`;let r="";const o=e-5-13;if(o>0){r=`${pe(10**(o-1),10**o-1)}`}const i=((e,t=2)=>String(e).padStart(t,"0"))(Ee,5);return Ee++,`${n}${r}${i}`},Ce=e=>e[pe(0,e.length-1)];function $e(e,t,n){let r=250,o=13;const i=e.children[0];G(t,12)<230?(i.style.maxWidth=G(t,12)+20+50+"px",r=n.clientX+(G(t,12)+50)-document.body.offsetWidth):(i.style.maxWidth="250px",r=n.clientX+230-document.body.offsetWidth),i.innerHTML=t,r>0&&(o-=r),e.style.top=n.clientY+23+"px",e.style.left=n.clientX+o+"px",e.style.maxWidth="250px";const s=e.getBoundingClientRect().top+i.offsetHeight-document.body.offsetHeight;s>0&&(e.style.top=n.clientY-s+"px")}const Te={handleMouseEnter:function({rootContainer:e="#root",title:t,event:n,bgColor:r="#000",color:o="#fff"}){try{const i=b(e)?document.querySelector(e):e;if(!i)throw new Error(`${e} is not valid Html Element or element selector`);let s=null;const a="style-tooltip-inner1494304949567";if(!document.querySelector(`#${a}`)){const e=document.createElement("style");e.type="text/css",e.id=a,e.innerHTML=`\n .tooltip-inner1494304949567 {\n max-width: 250px;\n padding: 3px 8px;\n color: ${o};\n text-decoration: none;\n border-radius: 4px;\n text-align: left;\n background-color: ${r};\n }\n `,document.querySelector("head").appendChild(e)}if(s=document.querySelector("#customTitle1494304949567"),s)$e(s,t,n);else{const e=document.createElement("div");e.id="customTitle1494304949567",e.style.cssText="z-index: 99999999; visibility: hidden; position: absolute;",e.innerHTML='<div class="tooltip-inner1494304949567" style="word-wrap: break-word; max-width: 44px;">皮肤</div>',i.appendChild(e),s=document.querySelector("#customTitle1494304949567"),t&&($e(s,t,n),s.style.visibility="visible")}}catch(e){console.error(e.message)}},handleMouseLeave:function(e="#root"){const t=b(e)?document.querySelector(e):e;let n=document.querySelector("#customTitle1494304949567");t&&n&&(t.removeChild(n),n=null)}},Re={keyField:"key",childField:"children",pidField:"pid"},Ne={childField:"children",nameField:"name",removeEmptyChild:!1,ignoreCase:!0};const Ie=(e,t)=>{let n=0;const r=e.toString(),o=t.toString();return void 0!==r.split(".")[1]&&(n+=r.split(".")[1].length),void 0!==o.split(".")[1]&&(n+=o.split(".")[1].length),Number(r.replace(".",""))*Number(o.replace(".",""))/Math.pow(10,n)},je=(e,t)=>{let n=0,r=0,o=0;try{n=e.toString().split(".")[1].length}catch(e){n=0}try{r=t.toString().split(".")[1].length}catch(e){r=0}return o=10**Math.max(n,r),(Ie(e,o)+Ie(t,o))/o};const De="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pe=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;function ke(e){let t,n,r,o,i="",s=0;const a=(e=String(e)).length,l=a%3;for(;s<a;){if((n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");t=n<<16|r<<8|o,i+=De.charAt(t>>18&63)+De.charAt(t>>12&63)+De.charAt(t>>6&63)+De.charAt(63&t)}return l?i.slice(0,l-3)+"===".substring(l):i}function Me(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Pe.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");let t,n,r,o="",i=0;for(const s=(e+="==".slice(2-(3&e.length))).length;i<s;)t=De.indexOf(e.charAt(i++))<<18|De.indexOf(e.charAt(i++))<<12|(n=De.indexOf(e.charAt(i++)))<<6|(r=De.indexOf(e.charAt(i++))),o+=64===n?String.fromCharCode(t>>16&255):64===r?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o}const Oe=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Le=/^(?:(?:\+|00)86)?1\d{10}$/,Be=/^(1[1-5]|2[1-3]|3[1-7]|4[1-6]|5[0-4]|6[1-5]|7[1]|8[1-2]|9[1])\d{4}(18|19|20)\d{2}[01]\d[0123]\d{4}[\dxX]$/,Ue=/^(https?|ftp):\/\/([^\s/$.?#].[^\s]*)$/i,He=/^https?:\/\/([^\s/$.?#].[^\s]*)$/i,ze=/^(?:(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/,We=/^(([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}|([\da-fA-F]{1,4}:){1,7}:|([\da-fA-F]{1,4}:){1,6}:[\da-fA-F]{1,4}|([\da-fA-F]{1,4}:){1,5}(:[\da-fA-F]{1,4}){1,2}|([\da-fA-F]{1,4}:){1,4}(:[\da-fA-F]{1,4}){1,3}|([\da-fA-F]{1,4}:){1,3}(:[\da-fA-F]{1,4}){1,4}|([\da-fA-F]{1,4}:){1,2}(:[\da-fA-F]{1,4}){1,5}|[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,6})|:((:[\da-fA-F]{1,4}){1,7}|:)|fe80:(:[\da-fA-F]{0,4}){0,4}%[\da-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?\d)?\d)\.){3}(25[0-5]|(2[0-4]|1?\d)?\d)|([\da-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?\d)?\d)\.){3}(25[0-5]|(2[0-4]|1?\d)?\d))$/i,qe=/^(-?[1-9]\d*|0)$/,_e=e=>qe.test(e),Ge=/^-?([1-9]\d*|0)\.\d*[1-9]$/,Ye=e=>Ge.test(e),Ve=/^\d+$/;function Xe(e){return[...new Set(e.trim().split(""))].join("")}function Je(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(e,t){return new RegExp(`${Je(e.trim())}\\s*([^${Je(Xe(e))}${Je(Xe(t))}\\s]*)\\s*${t.trim()}`,"g")}e.EMAIL_REGEX=Oe,e.HEX_POOL=me,e.HTTP_URL_REGEX=He,e.IPV4_REGEX=ze,e.IPV6_REGEX=We,e.PHONE_REGEX=Le,e.STRING_ARABIC_NUMERALS=B,e.STRING_LOWERCASE_ALPHA=U,e.STRING_POOL=ge,e.STRING_UPPERCASE_ALPHA=H,e.UNIQUE_NUMBER_SAFE_LENGTH=18,e.URL_REGEX=Ue,e.add=je,e.addClass=function(e,t){q(t,(t=>e.classList.add(t)))},e.arrayEach=t,e.arrayEachAsync=async function(e,t,n=!1){if(n)for(let n=e.length-1;n>=0&&!1!==await t(e[n],n);n--);else for(let n=0,r=e.length;n<r&&!1!==await t(e[n],n);n++);},e.arrayInsertBefore=function(e,t,n){if(t===n||t+1===n)return;const[r]=e.splice(t,1),o=n<t?n:n-1;e.splice(o,0,r)},e.arrayLike=m,e.arrayRemove=function(e,n){const r=[],o=n;return t(e,((e,t)=>{o(e,t)&&r.push(t)})),r.forEach(((t,n)=>{e.splice(t-n,1)})),e},e.asyncMap=function(e,t,n=1/0){return new Promise(((r,o)=>{const i=e[Symbol.iterator](),s=Math.min(e.length,n),a=[];let l,c=0,u=0;const d=()=>{if(l)return o(l);const n=i.next();if(n.done)return void(c===e.length&&r(a));const s=u++;t(n.value,s,e).then((e=>{c++,a[s]=e,d()})).catch((e=>{l=e,d()}))};for(let e=0;e<s;e++)d()}))},e.b64decode=function(e){const t=E(he("atob"))?Me(e):he("atob")(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return E(he("TextDecoder"))?function(e){const t=String.fromCharCode.apply(null,e);return decodeURIComponent(t)}(r):new(he("TextDecoder"))("utf-8").decode(r)},e.b64encode=function(e){const t=E(he("TextEncoder"))?function(e){const t=encodeURIComponent(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}(e):(new(he("TextEncoder"))).encode(e);let n="";const r=t.length;for(let e=0;e<r;e++)n+=String.fromCharCode(t[e]);return E(he("btoa"))?ke(n):he("btoa")(n)},e.calculateDate=function(e,t,n="-"){const r=new Date(e),o=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime()+864e5*parseInt(String(t)),i=new Date(o);return i.getFullYear()+n+String(i.getMonth()+1).padStart(2,"0")+"-"+String(i.getDate()).padStart(2,"0")},e.calculateDateTime=function(e,t,n="-",r=":"){const o=new Date(e),i=n,s=r,a=new Date(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds()).getTime()+864e5*parseInt(String(t)),l=new Date(a);return l.getFullYear()+i+String(l.getMonth()+1).padStart(2,"0")+i+String(l.getDate()).padStart(2,"0")+" "+String(l.getHours()).padStart(2,"0")+s+String(l.getMinutes()).padStart(2,"0")+s+String(l.getSeconds()).padStart(2,"0")},e.chooseLocalFile=function(e,t){let n=document.createElement("input");n.setAttribute("id",String(Date.now())),n.setAttribute("type","file"),n.setAttribute("style","visibility:hidden"),n.setAttribute("accept",e),document.body.appendChild(n),n.click(),n.onchange=e=>{t(e.target.files),setTimeout((()=>{document.body.removeChild(n),n=null}))}},e.cloneDeep=function e(t,n=new WeakMap){if(null===t||"object"!=typeof t)return t;if(n.has(t))return n.get(t);if(t instanceof ArrayBuffer){const e=new ArrayBuffer(t.byteLength);return new Uint8Array(e).set(new Uint8Array(t)),n.set(t,e),e}if(ArrayBuffer.isView(t)){return new(0,t.constructor)(e(t.buffer,n),t.byteOffset,t.length)}if(t instanceof Date){const e=new Date(t.getTime());return n.set(t,e),e}if(t instanceof RegExp){const e=new RegExp(t.source,t.flags);return e.lastIndex=t.lastIndex,n.set(t,e),e}if(t instanceof Map){const r=new Map;return n.set(t,r),t.forEach(((t,o)=>{r.set(e(o,n),e(t,n))})),r}if(t instanceof Set){const r=new Set;return n.set(t,r),t.forEach((t=>{r.add(e(t,n))})),r}if(Array.isArray(t)){const r=new Array(t.length);n.set(t,r);for(let o=0,i=t.length;o<i;o++)o in t&&(r[o]=e(t[o],n));const o=Object.getOwnPropertyDescriptors(t);for(const t of Reflect.ownKeys(o))Object.defineProperty(r,t,{...o[t],value:e(o[t].value,n)});return r}const r=Object.create(Object.getPrototypeOf(t));n.set(t,r);const o=Object.getOwnPropertyDescriptors(t);for(const t of Reflect.ownKeys(o)){const i=o[t];"value"in i?i.value=e(i.value,n):(i.get&&(i.get=e(i.get,n)),i.set&&(i.set=e(i.set,n))),Object.defineProperty(r,t,i)}return r},e.compressImg=function e(t,n={mime:"image/jpeg",minFileSizeKB:50}){if(!(t instanceof File||t instanceof FileList))throw new Error(`${t} require be File or FileList`);if(!de())throw new Error("Current runtime environment not support Canvas");const{quality:r,mime:o="image/jpeg",maxSize:i,minFileSizeKB:s=50}=v(n)?n:{};let a,l=r;if(r)l=r;else if(t instanceof File){const e=+parseInt((t.size/1024).toFixed(2));l=e<s?1:e<1024?.85:e<5120?.8:.75}return x(i)&&(a=i>=1200?i:1200),t instanceof FileList?Promise.all(Array.from(t).map((t=>e(t,{maxSize:a,mime:o,quality:l})))):t instanceof File?new Promise((e=>{const n=[...t.name.split(".").slice(0,-1),{"image/webp":"webp","image/jpeg":"jpg","image/png":"png"}[o]].join("."),r=+parseInt((t.size/1024).toFixed(2));if(r<s)e({file:t});else{const i=new FileReader;i.onload=({target:{result:i}})=>{const s=new Image;s.onload=()=>{const c=document.createElement("canvas"),u=c.getContext("2d"),d=s.width,f=s.height,{width:h,height:p}=function({sizeKB:e,maxSize:t,originWidth:n,originHeight:r}){let o=n,i=r;if(x(t)){const{width:e,height:s}=fe({maxWidth:t,maxHeight:t,originWidth:n,originHeight:r});o=e,i=s}else if(e<500){const e=1200,t=1200,{width:s,height:a}=fe({maxWidth:e,maxHeight:t,originWidth:n,originHeight:r});o=s,i=a}else if(e<5120){const e=1400,t=1400,{width:s,height:a}=fe({maxWidth:e,maxHeight:t,originWidth:n,originHeight:r});o=s,i=a}else if(e<10240){const e=1600,t=1600,{width:s,height:a}=fe({maxWidth:e,maxHeight:t,originWidth:n,originHeight:r});o=s,i=a}else if(10240<=e){const e=n>15e3?8192:n>1e4?4096:2048,t=r>15e3?8192:r>1e4?4096:2048,{width:s,height:a}=fe({maxWidth:e,maxHeight:t,originWidth:n,originHeight:r});o=s,i=a}return{width:o,height:i}}({sizeKB:r,maxSize:a,originWidth:d,originHeight:f});c.width=h,c.height=p,u.clearRect(0,0,h,p),u.drawImage(s,0,0,h,p);const g=c.toDataURL(o,l),m=atob(g.split(",")[1]);let y=m.length;const b=new Uint8Array(new ArrayBuffer(y));for(;y--;)b[y]=m.charCodeAt(y);const w=new File([b],n,{type:o});e({file:w,bufferArray:b,origin:t,beforeSrc:i,afterSrc:g,beforeKB:r,afterKB:Number((w.size/1024).toFixed(2))})},s.src=i},i.readAsDataURL(t)}})):Promise.resolve(null)},e.cookieDel=e=>X(e,"",-1),e.cookieGet=function(e){const{cookie:t}=document;if(!t)return"";const n=t.split(";");for(let t=0;t<n.length;t++){const r=n[t],[o,i=""]=r.split("=");if(o===e)return decodeURIComponent(i)}return""},e.cookieSet=X,e.copyText=function(e,t){const{successCallback:n,failCallback:r}=E(t)?{}:t;navigator.clipboard?navigator.clipboard.writeText(e).then((()=>{C(n)&&n()})).catch((n=>{V(e,t)})):V(e,t)},e.crossOriginDownload=function(e,t,n){const{successCode:r=200,successCallback:o,failCallback:i}=E(n)?{successCode:200,successCallback:void 0,failCallback:void 0}:n,s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="blob",s.onload=function(){if(s.status===r)ue(s.response,t,o);else if(C(i)){const e=s.status,t=s.getResponseHeader("Content-Type");if(b(t)&&t.includes("application/json")){const t=new FileReader;t.onload=()=>{i({status:e,response:t.result})},t.readAsText(s.response)}else i(s)}},s.onerror=e=>{C(i)&&i({status:0,code:"ERROR_CONNECTION_REFUSED"})},s.send()},e.dateParse=Q,e.dateToEnd=function(e){const t=ee(e);return t.setDate(t.getDate()+1),Q(t.getTime()-1)},e.dateToStart=ee,e.debounce=(e,t)=>{let n,r=!1;const o=function(...o){r||(clearTimeout(n),n=setTimeout((()=>{e.call(this,...o)}),t))};return o.cancel=()=>{clearTimeout(n),r=!0},o},e.divide=(e,t)=>{let n=0,r=0,o=0,i=0;return void 0!==e.toString().split(".")[1]&&(n=e.toString().split(".")[1].length),void 0!==t.toString().split(".")[1]&&(r=t.toString().split(".")[1].length),o=Number(e.toString().replace(".","")),i=Number(t.toString().replace(".","")),o/i*Math.pow(10,r-n)},e.downloadBlob=ue,e.downloadData=function(e,t,n,r){if(n=n.replace(`.${t}`,"")+`.${t}`,"json"===t){ue(new Blob([JSON.stringify(e,null,4)]),n)}else{if(!r||!r.length)throw new Error("未传入表头数据");if(!Array.isArray(e))throw new Error("data error! expected array!");const o=r.join(",")+"\n";let i="";e.forEach((e=>{i+=Object.values(e).join(",\t")+",\n"}));ce("data:"+{csv:"text/csv",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}[t]+";charset=utf-8,\ufeff"+encodeURIComponent(o+i),n)}},e.downloadHref=ce,e.downloadURL=function(e,t){window.open(t?le(e,t):e)},e.easingFunctional=j,e.easingStringify=function(e){let t;if(F(e))t=e;else{const n=I[e];if(!n)throw new Error(`${e} 缓冲函数未定义`);t=n}return`cubic-bezier(${t.join(",")})`},e.escapeRegExp=Je,e.executeInScope=function(e,t={}){const n=Object.keys(t),r=n.map((e=>t[e]));try{return new Function(...n,`return (() => { ${e} })()`)(...r)}catch(e){throw new Error(`代码执行失败: ${e.message}`)}},e.fallbackCopyText=V,e.flatTree=function e(t,n=Re){const{keyField:r="key",childField:o="children",pidField:i="pid"}=v(n)?n:{};let s=[];for(let a=0,l=t.length;a<l;a++){const l=t[a],c={...l,[o]:[]};if(g(c,o)&&delete c[o],s.push(c),l[o]){const t=l[o].map((e=>({...e,[i]:l[r]||e.pid})));s=s.concat(e(t,n))}}return s},e.forEachDeep=function(e,t,n={childField:"children",reverse:!1,breadthFirst:!1,isDomNode:!1}){const{childField:r="children",reverse:o=!1,breadthFirst:i=!1,isDomNode:s=!1}=v(n)?n:{};let a=!1;const l=[],c=(n,u,d=0)=>{if(o){for(let o=n.length-1;o>=0&&!a;o--){const f=n[o];if(i)l.push({item:f,index:o,array:n,tree:e,parent:u,level:d});else{const i=t(f,o,n,e,u,d);if(!1===i){a=!0;break}if(!0===i)continue;f&&(s?N(f[r]):Array.isArray(f[r]))&&c(f[r],f,d+1)}}if(i)for(;l.length>0&&!a;){const e=l.shift(),{item:n,index:o,array:i,tree:u,parent:d,level:f}=e,h=t(n,o,i,u,d,f);if(!1===h){a=!0;break}!0!==h&&(n&&(s?N(n[r]):Array.isArray(n[r]))&&c(n[r],n,f+1))}}else{for(let o=0,f=n.length;o<f&&!a;o++){const f=n[o];if(i)l.push({item:f,index:o,array:n,tree:e,parent:u,level:d});else{const i=t(f,o,n,e,u,d);if(!1===i){a=!0;break}if(!0===i)continue;f&&(s?N(f[r]):Array.isArray(f[r]))&&c(f[r],f,d+1)}}if(i)for(;l.length>0&&!a;){const e=l.shift();if(!e)break;const{item:n,index:o,array:i,tree:u,parent:d,level:f}=e,h=t(n,o,i,u,d,f);if(!1===h){a=!0;break}!0!==h&&(n&&(s?N(n[r]):Array.isArray(n[r]))&&c(n[r],n,f+1))}}};c(e,null,0),e=null},e.formatDate=function(e,t="YYYY-MM-DD HH:mm:ss"){const n=Q(e);let r,o=t;const i={"Y+":`${n.getFullYear()}`,"y+":`${n.getFullYear()}`,"M+":`${n.getMonth()+1}`,"D+":`${n.getDate()}`,"d+":`${n.getDate()}`,"H+":`${n.getHours()}`,"m+":`${n.getMinutes()}`,"s+":`${n.getSeconds()}`,"S+":`${n.getMilliseconds()}`,"w+":["周日","周一","周二","周三","周四","周五","周六"][n.getDay()]};for(const e in i)r=new RegExp("("+e+")").exec(o),r&&(o=o.replace(r[1],1===r[1].length?i[e]:i[e].padStart(r[1].length,"0")));return o},e.formatMoney=Ae,e.formatNumber=Ae,e.formatTree=function(e,t=Re){const{keyField:n="key",childField:r="children",pidField:o="pid"}=v(t)?t:{},i=[],s={};for(let t=0,r=e.length;t<r;t++){const r=e[t];s[r[n]]=r}for(let t=0,n=e.length;t<n;t++){const n=e[t],a=s[n[o]];a?(a[r]||(a[r]=[])).push(n):i.push(n)}return e=null,i},e.fuzzySearchTree=function e(t,n,r=Ne){if(!g(n,"filter")&&(!g(n,"keyword")||R(n.keyword)))return t;const o=[];for(let i=0,s=t.length;i<s;i++){const s=t[i],a=s[r.childField]&&s[r.childField].length>0?e(s[r.childField]||[],n,r):[];if((g(n,"filter")?n.filter(s):r.ignoreCase?s[r.nameField].toLowerCase().includes(n.keyword.toLowerCase()):s[r.nameField].includes(n.keyword))||a.length>0)if(s[r.childField])if(a.length>0)o.push({...s,[r.childField]:a});else if(r.removeEmptyChild){const{[r.childField]:e,...t}=s;o.push(t)}else o.push({...s,[r.childField]:[]});else{const{[r.childField]:e,...t}=s;o.push(t)}}return o},e.genCanvasWM=function e(t="请勿外传",n){const{rootContainer:r=document.body,width:o="300px",height:i="150px",textAlign:s="center",textBaseline:a="middle",font:l="20px PingFangSC-Medium,PingFang SC",fillStyle:c="rgba(189, 177, 167, .3)",rotate:u=-20,zIndex:d=2147483647,watermarkId:f="__wm"}=E(n)?{}:n,h=b(r)?document.querySelector(r):r;if(!h)throw new Error(`${r} is not valid Html Element or element selector`);const p=document.createElement("canvas");p.setAttribute("width",o),p.setAttribute("height",i);const g=p.getContext("2d");g.textAlign=s,g.textBaseline=a,g.font=l,g.fillStyle=c,g.rotate(Math.PI/180*u),g.fillText(t,parseFloat(o)/4,parseFloat(i)/2);const m=p.toDataURL(),y=document.querySelector(`#${f}`),w=y||document.createElement("div"),x=`opacity: 1 !important; display: block !important; visibility: visible !important; position:absolute; left:0; top:0; width:100%; height:100%; z-index:${d}; pointer-events:none; background-repeat:repeat; background-image:url('${m}')`;w.setAttribute("style",x),w.setAttribute("id",f),w.classList.add("nav-height"),y||(h.style.position="relative",h.appendChild(w));const S=window.MutationObserver||window.WebKitMutationObserver;if(S){let r=new S((function(){let o=document.querySelector(`#${f}`);if(o){const{opacity:i,zIndex:s,display:a,visibility:l}=(e=>{const t=getComputedStyle(e);return{opacity:t.getPropertyValue("opacity"),zIndex:t.getPropertyValue("z-index"),display:t.getPropertyValue("display"),visibility:t.getPropertyValue("visibility")}})(o);(o&&o.getAttribute("style")!==x||!o||"1"!==i||"2147483647"!==s||"block"!==a||"visible"!==l)&&(r.disconnect(),r=null,h.removeChild(o),o=null,e(t,n))}else r.disconnect(),r=null,e(t,n)}));r.observe(h,{attributes:!0,subtree:!0,childList:!0})}},e.getComputedCssVal=function(e,t,n=!0){const r=getComputedStyle(e).getPropertyValue(t)??"";return n?Number(r.replace(/([0-9]*)(.*)/g,"$1")):r},e.getEasing=function(e){return e?I[e]:I},e.getGlobal=he,e.getStrWidthPx=G,e.getStyle=function(e,t){return getComputedStyle(e).getPropertyValue(t)},e.hasClass=function(e,t){if(-1!==t.indexOf(" "))throw new Error("className should not contain space.");return e.classList.contains(t)},e.humanFileSize=function(e,t={decimals:0,si:!1,separator:" "}){const{decimals:n=0,si:r=!1,separator:o=" ",baseUnit:i,maxUnit:s}=t;let a=r?["B","kB","MB","GB","TB","PB","EB","ZB","YB"]:["Byte","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];if(!E(i)){const e=a.findIndex((e=>e===i));-1!==e&&(a=a.slice(e))}if(!E(s)){const e=a.findIndex((e=>e===s));-1!==e&&a.splice(e+1)}return Se(e,a,{ratio:r?1e3:1024,decimals:n,separator:o})},e.isArray=F,e.isBigInt=e=>"bigint"==typeof e,e.isBoolean=w,e.isDate=T,e.isDigit=e=>Ve.test(e),e.isEmail=e=>Oe.test(e),e.isEmpty=R,e.isError=e=>"Error"===y(e),e.isFloat=Ye,e.isFunction=C,e.isIdNo=e=>{if(!Be.test(e))return!1;const t=Number(e.slice(6,10)),n=Number(e.slice(10,12)),r=Number(e.slice(12,14)),o=new Date(t,n-1,r);if(!(o.getFullYear()===t&&o.getMonth()+1===n&&o.getDate()===r))return!1;const i=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];let s=0;for(let t=0;t<17;t++)s+=Number(e.slice(t,t+1))*i[t];return["1","0","X","9","8","7","6","5","4","3","2"][s%11]===e.slice(-1)},e.isInteger=_e,e.isIpV4=e=>ze.test(e),e.isIpV6=e=>We.test(e),e.isJsonString=function(e){try{const t=JSON.parse(e);return"object"==typeof t&&null!==t&&t}catch(e){return!1}},e.isNaN=$,e.isNodeList=N,e.isNull=A,e.isNullOrUnDef=E,e.isNullish=E,e.isNumber=x,e.isNumerical=e=>_e(e)||Ye(e),e.isObject=v,e.isPhone=e=>Le.test(e),e.isPlainObject=D,e.isPrimitive=e=>null===e||"object"!=typeof e,e.isRegExp=e=>"RegExp"===y(e),e.isString=b,e.isSymbol=e=>"symbol"==typeof e,e.isUndefined=S,e.isUrl=(e,t=!1)=>(t?Ue:He).test(e),e.isValidDate=J,e.mapDeep=function(e,t,n={childField:"children",reverse:!1}){const{childField:r="children",reverse:o=!1}=v(n)?n:{};let i=!1;const s=[],a=(n,s,l,c=0)=>{if(o)for(let o=n.length-1;o>=0&&!i;o--){const u=n[o],d=t(u,o,n,e,s,c);if(!1===d){i=!0;break}!0!==d&&(l.push(k(d,[r])),u&&Array.isArray(u[r])?(l[l.length-1][r]=[],a(u[r],u,l[l.length-1][r],c+1)):delete d[r])}else for(let o=0;o<n.length&&!i;o++){const u=n[o],d=t(u,o,n,e,s,c);if(!1===d){i=!0;break}!0!==d&&(l.push(k(d,[r])),u&&Array.isArray(u[r])?(l[l.length-1][r]=[],a(u[r],u,l[l.length-1][r],c+1)):delete d[r])}};return a(e,null,s),e=null,s},e.multiply=Ie,e.numberAbbr=Se,e.numberToHex=xe,e.objectAssign=O,e.objectEach=P,e.objectEachAsync=async function(e,t){for(const n in e)if(g(e,n)&&!1===await t(e[n],n))break},e.objectFill=function(e,t,n){const r=n||((e,t,n)=>void 0===e[n]);return P(t,((n,o)=>{r(e,t,o)&&(e[o]=n)})),e},e.objectGet=function(e,t,n=!1){const r=(t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split(".");let o=e,i=0;for(let e=r.length;i<e-1;++i){const e=r[i];if(x(Number(e))&&Array.isArray(o))o=o[e];else{if(!v(o)||!g(o,e)){if(o=void 0,n)throw new Error("[Object] objectGet path 路径不正确");break}o=o[e]}}return{p:o,k:o?r[i]:void 0,v:o?o[r[i]]:void 0}},e.objectHas=g,e.objectMap=function(e,t){const n={};for(const r in e)g(e,r)&&(n[r]=t(e[r],r));return e=null,n},e.objectMerge=O,e.objectOmit=k,e.objectPick=function(e,t){const n={};return P(e,((e,r)=>{t.includes(r)&&(n[r]=e)})),e=null,n},e.once=e=>{let t,n=!1;return function(...r){return n||(n=!0,t=e.call(this,...r)),t}},e.parseQueryParams=function(e=location.search){const t={};return Array.from(e.matchAll(/[&?]?([^=&]+)=?([^=&]*)/g)).forEach(((e,n)=>{t[e[1]]?"string"==typeof t[e[1]]?t[e[1]]=[t[e[1]],e[2]]:t[e[1]].push(e[2]):t[e[1]]=e[2]})),t},e.parseVarFromString=function(e,t="{",n="}"){return Array.from(e.matchAll(Ke(t,n))).map((e=>E(e)?void 0:e[1]))},e.pathJoin=ne,e.pathNormalize=te,e.qsParse=re,e.qsStringify=ie,e.randomNumber=pe,e.randomString=(e,t)=>{let n=0,r=ge;b(t)?(n=e,r=t):x(e)?n=e:b(e)&&(r=e);let o=Math.max(n,1),i="";const s=r.length-1;if(s<2)throw new Error("字符串池长度不能少于 2");for(;o--;){i+=r[pe(0,s)]}return i},e.randomUuid=function(){if("undefined"==typeof URL||!URL.createObjectURL||"undefined"==typeof Blob){const e="0123456789abcdef",t="xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx";let n="";for(let r=0;r<t.length;r++){const o=pe(0,15);n+="-"==t[r]||"4"==t[r]?t[r]:e[o]}return n}return/[^/]+$/.exec(URL.createObjectURL(new Blob).slice())[0]},e.removeClass=function(e,t){q(t,(t=>e.classList.remove(t)))},e.replaceVarFromString=function(e,t,n="{",r="}"){return e.replace(new RegExp(Ke(n,r)),(function(e,n){return g(t,n)?t[n]:e}))},e.safeAwait=function(e,t){return e.then((e=>[null,e])).catch((e=>{if(t){return[Object.assign({},e,t),void 0]}return[e,void 0]}))},e.searchTreeById=function(e,t,n={childField:"children",keyField:"id"}){const{childField:r="children",keyField:o="id"}=v(n)?n:{},i=(e,t,n)=>e.reduce(((e,s)=>{const a=s[r];return[...e,t?{...s,parentId:t,parent:n}:s,...a&&a.length?i(a,s[o],s):[]]}),[]);return(e=>{let n=e.find((e=>e[o]===t));const{parent:r,parentId:i,...s}=n;let a=[t],l=[s];for(;n&&n.parentId;)a=[n.parentId,...a],l=[n.parent,...l],n=e.find((e=>e[o]===n.parentId));return[a,l]})(i(e))},e.select=Y,e.setEasing=function(e,t){I[e]=t},e.setGlobal=function(e,t){if("undefined"!=typeof globalThis)globalThis[e]=t;else if("undefined"!=typeof window)window[e]=t;else if("undefined"!=typeof global)global[e]=t;else{if("undefined"==typeof self)throw new SyntaxError("当前环境下无法设置全局属性");self[e]=t}},e.setStyle=_,e.smoothScroll=function(e){return new Promise((n=>{const r={el:document,to:0,duration:567,easing:"ease"},{el:o,to:i,duration:s,easing:a}=O(r,e),l=document.documentElement,c=document.body,u=o===window||o===document||o===l||o===c?[l,c]:[o];let d;const f=(()=>{let e=0;return t(u,(t=>{if("scrollTop"in t)return e=t.scrollTop,!1})),e})(),h=i-f,p=j(a),g=()=>{const e=performance.now(),t=(d?e-d:0)/s,r=p(t);var o;d||(d=e),o=f+h*r,u.forEach((e=>{"scrollTop"in e&&(e.scrollTop=o)})),t>=1?n():requestAnimationFrame(g)};g()}))},e.stringAssign=(e,t)=>e.replace(W,((e,n)=>((e,t)=>{try{return new Function(`with(arguments[0]){if(arguments[0].${e} === undefined)throw "";return String(arguments[0].${e})}`)(t)}catch(t){throw new SyntaxError(`无法执行表达式:${e}`)}})(n,t))),e.stringCamelCase=function(e,t){let n=e;return t&&(n=e.replace(/^./,(e=>e.toUpperCase()))),n.replace(/[\s_-](.)/g,((e,t)=>t.toUpperCase()))},e.stringEscapeHtml=e=>{const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};return e.replace(/[&<>"]/g,(e=>t[e]))},e.stringFill=(e,t=" ")=>new Array(e).fill(t).join(""),e.stringFormat=function(e,...t){let n=0;return[e.replace(z,(e=>{const r=t[n++];switch(e){case"%%":return n--,"%";default:case"%s":return String(r);case"%d":return String(Number(r));case"%o":return JSON.stringify(r)}})),...t.splice(n).map(String)].join(" ")},e.stringKebabCase=L,e.strip=function(e,t=15){return+parseFloat(Number(e).toPrecision(t))},e.subtract=(e,t)=>je(e,-t),e.supportCanvas=de,e.throttle=(e,t,n)=>{let r,o=!1,i=0;const s=function(...s){if(o)return;const a=Date.now(),l=()=>{i=a,e.call(this,...s)};if(0===i)return n?l():void(i=a);i+t-a>0?(clearTimeout(r),r=setTimeout((()=>l()),t)):l()};return s.cancel=()=>{clearTimeout(r),o=!0},s},e.tooltipEvent=Te,e.typeIs=y,e.uniqueNumber=Fe,e.uniqueString=(e,t)=>{let n=0,r=me;b(t)?(n=e,r=t):x(e)?n=e:b(e)&&(r=e);let o=xe(Fe(),r),i=n-o.length;if(i<=0)return o;for(;i--;)o+=Ce(r);return o},e.uniqueSymbol=Xe,e.urlDelParams=(e,t)=>{const n=se(e);return t.forEach((e=>delete n.searchParams[e])),ae(n)},e.urlParse=se,e.urlSetParams=le,e.urlStringify=ae,e.wait=function(e=1){return new Promise((t=>setTimeout(t,e)))},e.weAtob=Me,e.weBtoa=ke}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sculp-js",
3
- "version": "1.13.1",
4
- "description": "js utils library, includes function library、class library",
3
+ "version": "1.13.3-beta.0",
4
+ "description": "Utils function library for modern javascript",
5
5
  "scripts": {
6
6
  "prepare": "husky install",
7
7
  "build": "rollup --bundleConfigAsCjs --config rollup.config.js",
@@ -12,31 +12,248 @@
12
12
  "coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
13
13
  "lint": "eslint ./src --ext .vue,.js,jsx,.ts,tsx",
14
14
  "lint:fix": "eslint --fix ./src --ext .vue,.js,jsx,.ts,tsx",
15
- "prettier": "prettier -c --write \"**/*.{vue,ts,js,jsx,css,less,scss,json}\"",
16
- "release:patch": "standard-version --release-as patch",
17
- "release:minor": "standard-version --release-as minor",
18
- "release:major": "standard-version --release-as major",
19
- "commit": "git-cz"
15
+ "prettier": "prettier -c --write \"**/*.{vue,ts,js,jsx,css,less,scss,json}\""
16
+ },
17
+ "main": "dist/cjs/index.js",
18
+ "module": "dist/esm/index.js",
19
+ "browser": "dist/umd/index.min.js",
20
+ "unpkg": "dist/umd/index.min.js",
21
+ "types": "dist/types/index.d.ts",
22
+ "typesVersions": {
23
+ "*": {
24
+ "./array": [
25
+ "./dist/types/array.d.ts"
26
+ ],
27
+ "./async": [
28
+ "./dist/types/async.d.ts"
29
+ ],
30
+ "./base64": [
31
+ "./dist/types/base64.d.ts"
32
+ ],
33
+ "./clipboard": [
34
+ "./dist/types/clipboard.d.ts"
35
+ ],
36
+ "./cloneDeep": [
37
+ "./dist/types/cloneDeep.d.ts"
38
+ ],
39
+ "./cookie": [
40
+ "./dist/types/cookie.d.ts"
41
+ ],
42
+ "./date": [
43
+ "./dist/types/date.d.ts"
44
+ ],
45
+ "./dom": [
46
+ "./dist/types/dom.d.ts"
47
+ ],
48
+ "./download": [
49
+ "./dist/types/download.d.ts"
50
+ ],
51
+ "./easing": [
52
+ "./dist/types/easing.d.ts"
53
+ ],
54
+ "./file": [
55
+ "./dist/types/file.d.ts"
56
+ ],
57
+ "./func": [
58
+ "./dist/types/func.d.ts"
59
+ ],
60
+ "./math": [
61
+ "./dist/types/math.d.ts"
62
+ ],
63
+ "./number": [
64
+ "./dist/types/number.d.ts"
65
+ ],
66
+ "./object": [
67
+ "./dist/types/object.d.ts"
68
+ ],
69
+ "./path": [
70
+ "./dist/types/path.d.ts"
71
+ ],
72
+ "./qs": [
73
+ "./dist/types/qs.d.ts"
74
+ ],
75
+ "./random": [
76
+ "./dist/types/random.d.ts"
77
+ ],
78
+ "./string": [
79
+ "./dist/types/string.d.ts"
80
+ ],
81
+ "./tooltip": [
82
+ "./dist/types/tooltip.d.ts"
83
+ ],
84
+ "./tree": [
85
+ "./dist/types/tree.d.ts"
86
+ ],
87
+ "./type": [
88
+ "./dist/types/type.d.ts"
89
+ ],
90
+ "./unique": [
91
+ "./dist/types/unique.d.ts"
92
+ ],
93
+ "./url": [
94
+ "./dist/types/url.d.ts"
95
+ ],
96
+ "./validator": [
97
+ "./dist/types/validator.d.ts"
98
+ ],
99
+ "./variable": [
100
+ "./dist/types/variable.d.ts"
101
+ ],
102
+ "./watermark": [
103
+ "./dist/types/watermark.d.ts"
104
+ ]
105
+ }
20
106
  },
21
- "main": "lib/cjs/index.js",
22
- "module": "lib/es/index.js",
23
- "browser": "lib/umd/index.js",
24
- "unpkg": "lib/umd/index.js",
25
- "types": "lib/index.d.ts",
26
- "typings": "lib/index.d.ts",
27
107
  "exports": {
28
108
  ".": {
29
- "import": "./lib/es/index.js",
30
- "require": "./lib/cjs/index.js",
31
- "types": "./lib/index.d.ts"
109
+ "import": "./dist/esm/index.js",
110
+ "require": "./dist/cjs/index.js",
111
+ "types": "./dist/types/index.d.ts"
112
+ },
113
+ "./package.json": "./package.json",
114
+ "./array": {
115
+ "import": "./dist/esm/array.js",
116
+ "require": "./dist/cjs/array.js",
117
+ "types": "./dist/types/array.d.ts"
118
+ },
119
+ "./async": {
120
+ "import": "./dist/esm/async.js",
121
+ "require": "./dist/cjs/async.js",
122
+ "types": "./dist/types/async.d.ts"
123
+ },
124
+ "./base64": {
125
+ "import": "./dist/esm/base64.js",
126
+ "require": "./dist/cjs/base64.js",
127
+ "types": "./dist/types/base64.d.ts"
128
+ },
129
+ "./clipboard": {
130
+ "import": "./dist/esm/clipboard.js",
131
+ "require": "./dist/cjs/clipboard.js",
132
+ "types": "./dist/types/clipboard.d.ts"
133
+ },
134
+ "./cloneDeep": {
135
+ "import": "./dist/esm/cloneDeep.js",
136
+ "require": "./dist/cjs/cloneDeep.js",
137
+ "types": "./dist/types/cloneDeep.d.ts"
138
+ },
139
+ "./cookie": {
140
+ "import": "./dist/esm/cookie.js",
141
+ "require": "./dist/cjs/cookie.js",
142
+ "types": "./dist/types/cookie.d.ts"
143
+ },
144
+ "./date": {
145
+ "import": "./dist/esm/date.js",
146
+ "require": "./dist/cjs/date.js",
147
+ "types": "./dist/types/date.d.ts"
148
+ },
149
+ "./dom": {
150
+ "import": "./dist/esm/dom.js",
151
+ "require": "./dist/cjs/dom.js",
152
+ "types": "./dist/types/dom.d.ts"
153
+ },
154
+ "./download": {
155
+ "import": "./dist/esm/download.js",
156
+ "require": "./dist/cjs/download.js",
157
+ "types": "./dist/types/download.d.ts"
158
+ },
159
+ "./easing": {
160
+ "import": "./dist/esm/easing.js",
161
+ "require": "./dist/cjs/easing.js",
162
+ "types": "./dist/types/easing.d.ts"
163
+ },
164
+ "./file": {
165
+ "import": "./dist/esm/file.js",
166
+ "require": "./dist/cjs/file.js",
167
+ "types": "./dist/types/file.d.ts"
168
+ },
169
+ "./func": {
170
+ "import": "./dist/esm/func.js",
171
+ "require": "./dist/cjs/func.js",
172
+ "types": "./dist/types/func.d.ts"
173
+ },
174
+ "./math": {
175
+ "import": "./dist/esm/math.js",
176
+ "require": "./dist/cjs/math.js",
177
+ "types": "./dist/types/math.d.ts"
178
+ },
179
+ "./number": {
180
+ "import": "./dist/esm/number.js",
181
+ "require": "./dist/cjs/number.js",
182
+ "types": "./dist/types/number.d.ts"
183
+ },
184
+ "./object": {
185
+ "import": "./dist/esm/object.js",
186
+ "require": "./dist/cjs/object.js",
187
+ "types": "./dist/types/object.d.ts"
188
+ },
189
+ "./path": {
190
+ "import": "./dist/esm/path.js",
191
+ "require": "./dist/cjs/path.js",
192
+ "types": "./dist/types/path.d.ts"
193
+ },
194
+ "./qs": {
195
+ "import": "./dist/esm/qs.js",
196
+ "require": "./dist/cjs/qs.js",
197
+ "types": "./dist/types/qs.d.ts"
198
+ },
199
+ "./random": {
200
+ "import": "./dist/esm/random.js",
201
+ "require": "./dist/cjs/random.js",
202
+ "types": "./dist/types/random.d.ts"
203
+ },
204
+ "./string": {
205
+ "import": "./dist/esm/string.js",
206
+ "require": "./dist/cjs/string.js",
207
+ "types": "./dist/types/string.d.ts"
208
+ },
209
+ "./tooltip": {
210
+ "import": "./dist/esm/tooltip.js",
211
+ "require": "./dist/cjs/tooltip.js",
212
+ "types": "./dist/types/tooltip.d.ts"
213
+ },
214
+ "./tree": {
215
+ "import": "./dist/esm/tree.js",
216
+ "require": "./dist/cjs/tree.js",
217
+ "types": "./dist/types/tree.d.ts"
218
+ },
219
+ "./type": {
220
+ "import": "./dist/esm/type.js",
221
+ "require": "./dist/cjs/type.js",
222
+ "types": "./dist/types/type.d.ts"
223
+ },
224
+ "./unique": {
225
+ "import": "./dist/esm/unique.js",
226
+ "require": "./dist/cjs/unique.js",
227
+ "types": "./dist/types/unique.d.ts"
228
+ },
229
+ "./url": {
230
+ "import": "./dist/esm/url.js",
231
+ "require": "./dist/cjs/url.js",
232
+ "types": "./dist/types/url.d.ts"
233
+ },
234
+ "./validator": {
235
+ "import": "./dist/esm/validator.js",
236
+ "require": "./dist/cjs/validator.js",
237
+ "types": "./dist/types/validator.d.ts"
238
+ },
239
+ "./variable": {
240
+ "import": "./dist/esm/variable.js",
241
+ "require": "./dist/cjs/variable.js",
242
+ "types": "./dist/types/variable.d.ts"
243
+ },
244
+ "./watermark": {
245
+ "import": "./dist/esm/watermark.js",
246
+ "require": "./dist/cjs/watermark.js",
247
+ "types": "./dist/types/watermark.d.ts"
32
248
  }
33
249
  },
34
250
  "sideEffects": false,
35
251
  "files": [
36
- "lib"
252
+ "dist"
37
253
  ],
38
254
  "keywords": [
39
255
  "sculp-js",
256
+ "modules",
40
257
  "es6",
41
258
  "util"
42
259
  ],
package/lib/cjs/base64.js DELETED
@@ -1,62 +0,0 @@
1
- /*!
2
- * sculp-js v1.13.1
3
- * (c) 2023-present chandq
4
- * Released under the MIT License.
5
- */
6
-
7
- 'use strict';
8
-
9
- var func = require('./func.js');
10
- var type = require('./type.js');
11
- var weDecode = require('./we-decode.js');
12
-
13
- function stringToUint8Array(str) {
14
- const utf8 = encodeURIComponent(str); // 将字符串转换为 UTF-8 编码
15
- const uint8Array = new Uint8Array(utf8.length); // 创建 Uint8Array
16
- for (let i = 0; i < utf8.length; i++) {
17
- uint8Array[i] = utf8.charCodeAt(i); // 填充 Uint8Array
18
- }
19
- return uint8Array;
20
- }
21
- function uint8ArrayToString(uint8Array) {
22
- const utf8 = String.fromCharCode.apply(null, uint8Array); // 将 Uint8Array 转为字符串
23
- return decodeURIComponent(utf8); // 将 UTF-8 字符串解码回正常字符串
24
- }
25
- /**
26
- * 将base64编码的字符串转换为原始字符串,包括对中文内容的处理(高性能,且支持Web、Node、小程序等任意平台)
27
- * @param base64 base64编码的字符串
28
- * @returns 原始字符串,包括中文内容
29
- */
30
- function decodeFromBase64(base64) {
31
- const binaryString = !type.isNullOrUnDef(func.getGlobal('atob')) ? func.getGlobal('atob')(base64) : weDecode.weAtob(base64);
32
- const len = binaryString.length;
33
- const bytes = new Uint8Array(len);
34
- for (let i = 0; i < len; i++) {
35
- bytes[i] = binaryString.charCodeAt(i);
36
- }
37
- // 使用TextDecoder将Uint8Array转换为原始字符串,包括中文内容
38
- return !type.isNullOrUnDef(func.getGlobal('TextDecoder'))
39
- ? new (func.getGlobal('TextDecoder'))('utf-8').decode(bytes)
40
- : uint8ArrayToString(bytes);
41
- }
42
- /**
43
- * 将原始字符串,包括中文内容,转换为base64编码的字符串(高性能,且支持Web、Node、小程序等任意平台)
44
- * @param rawStr 原始字符串,包括中文内容
45
- * @returns base64编码的字符串
46
- */
47
- function encodeToBase64(rawStr) {
48
- const utf8Array = !type.isNullOrUnDef(func.getGlobal('TextEncoder'))
49
- ? new (func.getGlobal('TextEncoder'))().encode(rawStr)
50
- : stringToUint8Array(rawStr);
51
- // 将 Uint8Array 转换为二进制字符串
52
- let binaryString = '';
53
- const len = utf8Array.length;
54
- for (let i = 0; i < len; i++) {
55
- binaryString += String.fromCharCode(utf8Array[i]);
56
- }
57
- // 将二进制字符串转换为base64编码的字符串
58
- return !type.isNullOrUnDef(func.getGlobal('btoa')) ? func.getGlobal('btoa')(binaryString) : weDecode.weBtoa(binaryString);
59
- }
60
-
61
- exports.decodeFromBase64 = decodeFromBase64;
62
- exports.encodeToBase64 = encodeToBase64;