sculp-js 1.13.0 → 1.13.1
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/lib/cjs/array.js +1 -1
- package/lib/cjs/async.js +1 -1
- package/lib/cjs/base64.js +1 -1
- package/lib/cjs/clipboard.js +1 -1
- package/lib/cjs/cloneDeep.js +1 -1
- package/lib/cjs/cookie.js +1 -1
- package/lib/cjs/date.js +1 -1
- package/lib/cjs/dom.js +1 -1
- package/lib/cjs/download.js +1 -1
- package/lib/cjs/easing.js +1 -1
- package/lib/cjs/file.js +1 -1
- package/lib/cjs/func.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/isEqual.js +1 -1
- package/lib/cjs/math.js +1 -1
- package/lib/cjs/number.js +1 -1
- package/lib/cjs/object.js +1 -1
- package/lib/cjs/path.js +1 -1
- package/lib/cjs/qs.js +1 -1
- package/lib/cjs/random.js +1 -1
- package/lib/cjs/string.js +1 -1
- package/lib/cjs/tooltip.js +1 -1
- package/lib/cjs/tree.js +36 -28
- package/lib/cjs/type.js +1 -1
- package/lib/cjs/unique.js +1 -1
- package/lib/cjs/url.js +1 -1
- package/lib/cjs/validator.js +1 -1
- package/lib/cjs/variable.js +1 -1
- package/lib/cjs/watermark.js +1 -1
- package/lib/cjs/we-decode.js +1 -1
- package/lib/es/array.js +1 -1
- package/lib/es/async.js +1 -1
- package/lib/es/base64.js +1 -1
- package/lib/es/clipboard.js +1 -1
- package/lib/es/cloneDeep.js +1 -1
- package/lib/es/cookie.js +1 -1
- package/lib/es/date.js +1 -1
- package/lib/es/dom.js +1 -1
- package/lib/es/download.js +1 -1
- package/lib/es/easing.js +1 -1
- package/lib/es/file.js +1 -1
- package/lib/es/func.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/isEqual.js +1 -1
- package/lib/es/math.js +1 -1
- package/lib/es/number.js +1 -1
- package/lib/es/object.js +1 -1
- package/lib/es/path.js +1 -1
- package/lib/es/qs.js +1 -1
- package/lib/es/random.js +1 -1
- package/lib/es/string.js +1 -1
- package/lib/es/tooltip.js +1 -1
- package/lib/es/tree.js +36 -28
- package/lib/es/type.js +1 -1
- package/lib/es/unique.js +1 -1
- package/lib/es/url.js +1 -1
- package/lib/es/validator.js +1 -1
- package/lib/es/variable.js +1 -1
- package/lib/es/watermark.js +1 -1
- package/lib/es/we-decode.js +1 -1
- package/lib/index.d.ts +15 -12
- package/lib/umd/index.js +2 -2
- package/package.json +1 -1
package/lib/cjs/array.js
CHANGED
package/lib/cjs/async.js
CHANGED
package/lib/cjs/base64.js
CHANGED
package/lib/cjs/clipboard.js
CHANGED
package/lib/cjs/cloneDeep.js
CHANGED
package/lib/cjs/cookie.js
CHANGED
package/lib/cjs/date.js
CHANGED
package/lib/cjs/dom.js
CHANGED
package/lib/cjs/download.js
CHANGED
package/lib/cjs/easing.js
CHANGED
package/lib/cjs/file.js
CHANGED
package/lib/cjs/func.js
CHANGED
package/lib/cjs/index.js
CHANGED
package/lib/cjs/isEqual.js
CHANGED
package/lib/cjs/math.js
CHANGED
package/lib/cjs/number.js
CHANGED
package/lib/cjs/object.js
CHANGED
package/lib/cjs/path.js
CHANGED
package/lib/cjs/qs.js
CHANGED
package/lib/cjs/random.js
CHANGED
package/lib/cjs/string.js
CHANGED
package/lib/cjs/tooltip.js
CHANGED
package/lib/cjs/tree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.13.
|
|
2
|
+
* sculp-js v1.13.1
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -64,7 +64,7 @@ function forEachDeep(tree, iterator, options = {
|
|
|
64
64
|
}
|
|
65
65
|
if (breadthFirst) {
|
|
66
66
|
// Process queue
|
|
67
|
-
while (!isBreak) {
|
|
67
|
+
while (queue.length > 0 && !isBreak) {
|
|
68
68
|
const current = queue.shift();
|
|
69
69
|
// iterate(info);
|
|
70
70
|
// @ts-ignore
|
|
@@ -113,7 +113,7 @@ function forEachDeep(tree, iterator, options = {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
if (breadthFirst) {
|
|
116
|
-
while (!isBreak) {
|
|
116
|
+
while (queue.length > 0 && !isBreak) {
|
|
117
117
|
const current = queue.shift();
|
|
118
118
|
if (!current)
|
|
119
119
|
break;
|
|
@@ -146,20 +146,27 @@ function forEachDeep(tree, iterator, options = {
|
|
|
146
146
|
* 可遍历任何带有 length 属性和数字键的类数组对象
|
|
147
147
|
* @param {ArrayLike<V>} tree 树形数据
|
|
148
148
|
* @param {Function} iterator 迭代函数, 返回值为true时continue, 返回值为false时break
|
|
149
|
-
* @param {
|
|
150
|
-
|
|
149
|
+
* @param {options} options 支持定制子元素名称、反向遍历,默认{
|
|
150
|
+
childField: 'children',
|
|
151
|
+
reverse: false,
|
|
152
|
+
}
|
|
151
153
|
* @returns {any[]} 新的一棵树
|
|
152
154
|
*/
|
|
153
|
-
function mapDeep(tree, iterator,
|
|
155
|
+
function mapDeep(tree, iterator, options = {
|
|
156
|
+
childField: 'children',
|
|
157
|
+
reverse: false
|
|
158
|
+
}) {
|
|
159
|
+
const { childField = 'children', reverse = false } = type.isObject(options) ? options : {};
|
|
154
160
|
let isBreak = false;
|
|
155
161
|
const newTree = [];
|
|
156
162
|
const walk = (arr, parent, newTree, level = 0) => {
|
|
157
|
-
if (
|
|
163
|
+
if (reverse) {
|
|
158
164
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
159
165
|
if (isBreak) {
|
|
160
166
|
break;
|
|
161
167
|
}
|
|
162
|
-
const
|
|
168
|
+
const item = arr[i];
|
|
169
|
+
const re = iterator(item, i, arr, tree, parent, level);
|
|
163
170
|
if (re === false) {
|
|
164
171
|
isBreak = true;
|
|
165
172
|
break;
|
|
@@ -167,16 +174,16 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
167
174
|
else if (re === true) {
|
|
168
175
|
continue;
|
|
169
176
|
}
|
|
170
|
-
newTree.push(object.objectOmit(re, [
|
|
177
|
+
newTree.push(object.objectOmit(re, [childField]));
|
|
171
178
|
// @ts-ignore
|
|
172
|
-
if (
|
|
173
|
-
newTree[newTree.length - 1][
|
|
179
|
+
if (item && Array.isArray(item[childField])) {
|
|
180
|
+
newTree[newTree.length - 1][childField] = [];
|
|
174
181
|
// @ts-ignore
|
|
175
|
-
walk(
|
|
182
|
+
walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
|
|
176
183
|
}
|
|
177
184
|
else {
|
|
178
185
|
// children非有效数组时,移除该属性字段
|
|
179
|
-
delete re[
|
|
186
|
+
delete re[childField];
|
|
180
187
|
}
|
|
181
188
|
}
|
|
182
189
|
}
|
|
@@ -185,7 +192,8 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
185
192
|
if (isBreak) {
|
|
186
193
|
break;
|
|
187
194
|
}
|
|
188
|
-
const
|
|
195
|
+
const item = arr[i];
|
|
196
|
+
const re = iterator(item, i, arr, tree, parent, level);
|
|
189
197
|
if (re === false) {
|
|
190
198
|
isBreak = true;
|
|
191
199
|
break;
|
|
@@ -193,16 +201,16 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
193
201
|
else if (re === true) {
|
|
194
202
|
continue;
|
|
195
203
|
}
|
|
196
|
-
newTree.push(object.objectOmit(re, [
|
|
204
|
+
newTree.push(object.objectOmit(re, [childField]));
|
|
197
205
|
// @ts-ignore
|
|
198
|
-
if (
|
|
199
|
-
newTree[newTree.length - 1][
|
|
206
|
+
if (item && Array.isArray(item[childField])) {
|
|
207
|
+
newTree[newTree.length - 1][childField] = [];
|
|
200
208
|
// @ts-ignore
|
|
201
|
-
walk(
|
|
209
|
+
walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
|
|
202
210
|
}
|
|
203
211
|
else {
|
|
204
212
|
// children非有效数组时,移除该属性字段
|
|
205
|
-
delete re[
|
|
213
|
+
delete re[childField];
|
|
206
214
|
}
|
|
207
215
|
}
|
|
208
216
|
}
|
|
@@ -216,30 +224,30 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
216
224
|
* 在树中找到 id 为某个值的节点,并返回上游的所有父级节点
|
|
217
225
|
*
|
|
218
226
|
* @param {ArrayLike<T>} tree - 树形数据
|
|
219
|
-
* @param {
|
|
220
|
-
* @param {ITreeConf}
|
|
221
|
-
* @returns {[
|
|
227
|
+
* @param {number | string} nodeId - 目标元素ID
|
|
228
|
+
* @param {ITreeConf} options - 迭代配置项, 默认:{ children = 'children', id = 'id' }
|
|
229
|
+
* @returns {[(number | string)[], V[]]} - 由parentId...childId, parentObject-childObject组成的二维数组
|
|
222
230
|
*/
|
|
223
|
-
function searchTreeById(tree, nodeId,
|
|
224
|
-
const {
|
|
231
|
+
function searchTreeById(tree, nodeId, options = { childField: 'children', keyField: 'id' }) {
|
|
232
|
+
const { childField = 'children', keyField = 'id' } = type.isObject(options) ? options : {};
|
|
225
233
|
const toFlatArray = (tree, parentId, parent) => {
|
|
226
234
|
return tree.reduce((t, _) => {
|
|
227
|
-
const child = _[
|
|
235
|
+
const child = _[childField];
|
|
228
236
|
return [
|
|
229
237
|
...t,
|
|
230
238
|
parentId ? { ..._, parentId, parent } : _,
|
|
231
|
-
...(child && child.length ? toFlatArray(child, _[
|
|
239
|
+
...(child && child.length ? toFlatArray(child, _[keyField], _) : [])
|
|
232
240
|
];
|
|
233
241
|
}, []);
|
|
234
242
|
};
|
|
235
243
|
const getIds = (flatArray) => {
|
|
236
|
-
let child = flatArray.find(_ => _[
|
|
244
|
+
let child = flatArray.find(_ => _[keyField] === nodeId);
|
|
237
245
|
const { parent, parentId, ...other } = child;
|
|
238
246
|
let ids = [nodeId], nodes = [other];
|
|
239
247
|
while (child && child.parentId) {
|
|
240
248
|
ids = [child.parentId, ...ids];
|
|
241
249
|
nodes = [child.parent, ...nodes];
|
|
242
|
-
child = flatArray.find(_ => _[
|
|
250
|
+
child = flatArray.find(_ => _[keyField] === child.parentId); // eslint-disable-line
|
|
243
251
|
}
|
|
244
252
|
return [ids, nodes];
|
|
245
253
|
};
|
package/lib/cjs/type.js
CHANGED
package/lib/cjs/unique.js
CHANGED
package/lib/cjs/url.js
CHANGED
package/lib/cjs/validator.js
CHANGED
package/lib/cjs/variable.js
CHANGED
package/lib/cjs/watermark.js
CHANGED
package/lib/cjs/we-decode.js
CHANGED
package/lib/es/array.js
CHANGED
package/lib/es/async.js
CHANGED
package/lib/es/base64.js
CHANGED
package/lib/es/clipboard.js
CHANGED
package/lib/es/cloneDeep.js
CHANGED
package/lib/es/cookie.js
CHANGED
package/lib/es/date.js
CHANGED
package/lib/es/dom.js
CHANGED
package/lib/es/download.js
CHANGED
package/lib/es/easing.js
CHANGED
package/lib/es/file.js
CHANGED
package/lib/es/func.js
CHANGED
package/lib/es/index.js
CHANGED
package/lib/es/isEqual.js
CHANGED
package/lib/es/math.js
CHANGED
package/lib/es/number.js
CHANGED
package/lib/es/object.js
CHANGED
package/lib/es/path.js
CHANGED
package/lib/es/qs.js
CHANGED
package/lib/es/random.js
CHANGED
package/lib/es/string.js
CHANGED
package/lib/es/tooltip.js
CHANGED
package/lib/es/tree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.13.
|
|
2
|
+
* sculp-js v1.13.1
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -62,7 +62,7 @@ function forEachDeep(tree, iterator, options = {
|
|
|
62
62
|
}
|
|
63
63
|
if (breadthFirst) {
|
|
64
64
|
// Process queue
|
|
65
|
-
while (!isBreak) {
|
|
65
|
+
while (queue.length > 0 && !isBreak) {
|
|
66
66
|
const current = queue.shift();
|
|
67
67
|
// iterate(info);
|
|
68
68
|
// @ts-ignore
|
|
@@ -111,7 +111,7 @@ function forEachDeep(tree, iterator, options = {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
if (breadthFirst) {
|
|
114
|
-
while (!isBreak) {
|
|
114
|
+
while (queue.length > 0 && !isBreak) {
|
|
115
115
|
const current = queue.shift();
|
|
116
116
|
if (!current)
|
|
117
117
|
break;
|
|
@@ -144,20 +144,27 @@ function forEachDeep(tree, iterator, options = {
|
|
|
144
144
|
* 可遍历任何带有 length 属性和数字键的类数组对象
|
|
145
145
|
* @param {ArrayLike<V>} tree 树形数据
|
|
146
146
|
* @param {Function} iterator 迭代函数, 返回值为true时continue, 返回值为false时break
|
|
147
|
-
* @param {
|
|
148
|
-
|
|
147
|
+
* @param {options} options 支持定制子元素名称、反向遍历,默认{
|
|
148
|
+
childField: 'children',
|
|
149
|
+
reverse: false,
|
|
150
|
+
}
|
|
149
151
|
* @returns {any[]} 新的一棵树
|
|
150
152
|
*/
|
|
151
|
-
function mapDeep(tree, iterator,
|
|
153
|
+
function mapDeep(tree, iterator, options = {
|
|
154
|
+
childField: 'children',
|
|
155
|
+
reverse: false
|
|
156
|
+
}) {
|
|
157
|
+
const { childField = 'children', reverse = false } = isObject(options) ? options : {};
|
|
152
158
|
let isBreak = false;
|
|
153
159
|
const newTree = [];
|
|
154
160
|
const walk = (arr, parent, newTree, level = 0) => {
|
|
155
|
-
if (
|
|
161
|
+
if (reverse) {
|
|
156
162
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
157
163
|
if (isBreak) {
|
|
158
164
|
break;
|
|
159
165
|
}
|
|
160
|
-
const
|
|
166
|
+
const item = arr[i];
|
|
167
|
+
const re = iterator(item, i, arr, tree, parent, level);
|
|
161
168
|
if (re === false) {
|
|
162
169
|
isBreak = true;
|
|
163
170
|
break;
|
|
@@ -165,16 +172,16 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
165
172
|
else if (re === true) {
|
|
166
173
|
continue;
|
|
167
174
|
}
|
|
168
|
-
newTree.push(objectOmit(re, [
|
|
175
|
+
newTree.push(objectOmit(re, [childField]));
|
|
169
176
|
// @ts-ignore
|
|
170
|
-
if (
|
|
171
|
-
newTree[newTree.length - 1][
|
|
177
|
+
if (item && Array.isArray(item[childField])) {
|
|
178
|
+
newTree[newTree.length - 1][childField] = [];
|
|
172
179
|
// @ts-ignore
|
|
173
|
-
walk(
|
|
180
|
+
walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
|
|
174
181
|
}
|
|
175
182
|
else {
|
|
176
183
|
// children非有效数组时,移除该属性字段
|
|
177
|
-
delete re[
|
|
184
|
+
delete re[childField];
|
|
178
185
|
}
|
|
179
186
|
}
|
|
180
187
|
}
|
|
@@ -183,7 +190,8 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
183
190
|
if (isBreak) {
|
|
184
191
|
break;
|
|
185
192
|
}
|
|
186
|
-
const
|
|
193
|
+
const item = arr[i];
|
|
194
|
+
const re = iterator(item, i, arr, tree, parent, level);
|
|
187
195
|
if (re === false) {
|
|
188
196
|
isBreak = true;
|
|
189
197
|
break;
|
|
@@ -191,16 +199,16 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
191
199
|
else if (re === true) {
|
|
192
200
|
continue;
|
|
193
201
|
}
|
|
194
|
-
newTree.push(objectOmit(re, [
|
|
202
|
+
newTree.push(objectOmit(re, [childField]));
|
|
195
203
|
// @ts-ignore
|
|
196
|
-
if (
|
|
197
|
-
newTree[newTree.length - 1][
|
|
204
|
+
if (item && Array.isArray(item[childField])) {
|
|
205
|
+
newTree[newTree.length - 1][childField] = [];
|
|
198
206
|
// @ts-ignore
|
|
199
|
-
walk(
|
|
207
|
+
walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
|
|
200
208
|
}
|
|
201
209
|
else {
|
|
202
210
|
// children非有效数组时,移除该属性字段
|
|
203
|
-
delete re[
|
|
211
|
+
delete re[childField];
|
|
204
212
|
}
|
|
205
213
|
}
|
|
206
214
|
}
|
|
@@ -214,30 +222,30 @@ function mapDeep(tree, iterator, children = 'children', isReverse = false) {
|
|
|
214
222
|
* 在树中找到 id 为某个值的节点,并返回上游的所有父级节点
|
|
215
223
|
*
|
|
216
224
|
* @param {ArrayLike<T>} tree - 树形数据
|
|
217
|
-
* @param {
|
|
218
|
-
* @param {ITreeConf}
|
|
219
|
-
* @returns {[
|
|
225
|
+
* @param {number | string} nodeId - 目标元素ID
|
|
226
|
+
* @param {ITreeConf} options - 迭代配置项, 默认:{ children = 'children', id = 'id' }
|
|
227
|
+
* @returns {[(number | string)[], V[]]} - 由parentId...childId, parentObject-childObject组成的二维数组
|
|
220
228
|
*/
|
|
221
|
-
function searchTreeById(tree, nodeId,
|
|
222
|
-
const {
|
|
229
|
+
function searchTreeById(tree, nodeId, options = { childField: 'children', keyField: 'id' }) {
|
|
230
|
+
const { childField = 'children', keyField = 'id' } = isObject(options) ? options : {};
|
|
223
231
|
const toFlatArray = (tree, parentId, parent) => {
|
|
224
232
|
return tree.reduce((t, _) => {
|
|
225
|
-
const child = _[
|
|
233
|
+
const child = _[childField];
|
|
226
234
|
return [
|
|
227
235
|
...t,
|
|
228
236
|
parentId ? { ..._, parentId, parent } : _,
|
|
229
|
-
...(child && child.length ? toFlatArray(child, _[
|
|
237
|
+
...(child && child.length ? toFlatArray(child, _[keyField], _) : [])
|
|
230
238
|
];
|
|
231
239
|
}, []);
|
|
232
240
|
};
|
|
233
241
|
const getIds = (flatArray) => {
|
|
234
|
-
let child = flatArray.find(_ => _[
|
|
242
|
+
let child = flatArray.find(_ => _[keyField] === nodeId);
|
|
235
243
|
const { parent, parentId, ...other } = child;
|
|
236
244
|
let ids = [nodeId], nodes = [other];
|
|
237
245
|
while (child && child.parentId) {
|
|
238
246
|
ids = [child.parentId, ...ids];
|
|
239
247
|
nodes = [child.parent, ...nodes];
|
|
240
|
-
child = flatArray.find(_ => _[
|
|
248
|
+
child = flatArray.find(_ => _[keyField] === child.parentId); // eslint-disable-line
|
|
241
249
|
}
|
|
242
250
|
return [ids, nodes];
|
|
243
251
|
};
|
package/lib/es/type.js
CHANGED
package/lib/es/unique.js
CHANGED
package/lib/es/url.js
CHANGED
package/lib/es/validator.js
CHANGED
package/lib/es/variable.js
CHANGED
package/lib/es/watermark.js
CHANGED
package/lib/es/we-decode.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -930,27 +930,30 @@ declare function forEachDeep<V>(tree: ArrayLike<V>, iterator: (val: V, index: nu
|
|
|
930
930
|
* 可遍历任何带有 length 属性和数字键的类数组对象
|
|
931
931
|
* @param {ArrayLike<V>} tree 树形数据
|
|
932
932
|
* @param {Function} iterator 迭代函数, 返回值为true时continue, 返回值为false时break
|
|
933
|
-
* @param {
|
|
934
|
-
|
|
933
|
+
* @param {options} options 支持定制子元素名称、反向遍历,默认{
|
|
934
|
+
childField: 'children',
|
|
935
|
+
reverse: false,
|
|
936
|
+
}
|
|
935
937
|
* @returns {any[]} 新的一棵树
|
|
936
938
|
*/
|
|
937
|
-
declare function mapDeep<T>(tree: T[], iterator: (val: T,
|
|
939
|
+
declare function mapDeep<T>(tree: T[], iterator: (val: T, index: number, currentArr: T[], tree: T[], parent: T | null, level: number) => {
|
|
938
940
|
[k: string | number]: any;
|
|
939
|
-
} | boolean,
|
|
941
|
+
} | boolean, options?: {
|
|
942
|
+
childField?: string;
|
|
943
|
+
reverse?: boolean;
|
|
944
|
+
breadthFirst?: boolean;
|
|
945
|
+
}): any[];
|
|
940
946
|
type IdLike = number | string;
|
|
941
|
-
|
|
942
|
-
id: string | number;
|
|
943
|
-
children: string;
|
|
944
|
-
}
|
|
947
|
+
type ITreeConf = Omit<IFieldOptions, 'pidField'>;
|
|
945
948
|
/**
|
|
946
949
|
* 在树中找到 id 为某个值的节点,并返回上游的所有父级节点
|
|
947
950
|
*
|
|
948
951
|
* @param {ArrayLike<T>} tree - 树形数据
|
|
949
|
-
* @param {
|
|
950
|
-
* @param {ITreeConf}
|
|
951
|
-
* @returns {[
|
|
952
|
+
* @param {number | string} nodeId - 目标元素ID
|
|
953
|
+
* @param {ITreeConf} options - 迭代配置项, 默认:{ children = 'children', id = 'id' }
|
|
954
|
+
* @returns {[(number | string)[], V[]]} - 由parentId...childId, parentObject-childObject组成的二维数组
|
|
952
955
|
*/
|
|
953
|
-
declare function searchTreeById<V>(tree: ArrayLike<V>, nodeId: IdLike,
|
|
956
|
+
declare function searchTreeById<V>(tree: ArrayLike<V>, nodeId: IdLike, options?: ITreeConf): [(number | string)[], ArrayLike<V>[]];
|
|
954
957
|
/**
|
|
955
958
|
* 扁平化数组转换成树
|
|
956
959
|
* @param {any[]} list
|
package/lib/umd/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sculp-js v1.13.
|
|
2
|
+
* sculp-js v1.13.1
|
|
3
3
|
* (c) 2023-present chandq
|
|
4
4
|
* Released under the MIT License.
|
|
5
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 c(e,t,n){return((i(t,n)*e+s(t,n))*e+a(t))*e}function l(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]=c(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=l(a,e,n);return u>=.001?function(e,t,n,r){for(var o=0;o<4;++o){var i=l(t,n,r);if(0===i)return t;t-=(c(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=c(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:c(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,j=e=>Number.isNaN(e),$=e=>"Date"===y(e);function T(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}const R={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]};const I=e=>{if(!v(e))return!1;const t=Object.getPrototypeOf(e);return!t||t===Object.prototype};function O(e,t){for(const n in e)if(g(e,n)&&!1===t(e[n],n))break;e=null}function N(e,t){const n={};return O(e,((e,r)=>{t.includes(r)||(n[r]=e)})),e=null,n}const D=(e,t,n)=>{if(S(n))return t;if(y(t)!==y(n))return F(n)?D(e,[],n):v(n)?D(e,{},n):n;if(I(n)){const r=e.get(n);return r||(e.set(n,t),O(n,((n,r)=>{t[r]=D(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]=D(e,t[r],n)})),t)}return n};function k(e,...t){const n=new Map;for(let r=0,o=t.length;r<o;r++){const o=t[r];e=D(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 M="0123456789",P="abcdefghijklmnopqrstuvwxyz",B="ABCDEFGHIJKLMNOPQRSTUVWXYZ",U=/%[%sdo]/g;const H=/\${(.*?)}/g;const z=(e,t)=>{e.split(/\s+/g).forEach(t)};const W=(e,t,n)=>{v(t)?O(t,((t,n)=>{W(e,n,t)})):e.style.setProperty(L(t),n)};function q(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 _(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 G(e,t){const{successCallback:n,failCallback:r,container:o=document.body}=E(t)?{}:t,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),_(i);try{document.execCommand("copy")&&C(n)&&n()}catch(e){C(r)&&r(e)}finally{o.removeChild(i),window.getSelection()?.removeAllRanges()}}function V(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 $(n)&&r.push([o,n.toUTCString()]);r.push(["path","/"]),document.cookie=r.map((e=>{const[t,n]=e;return`${t}=${n}`})).join(";")}const Y=e=>$(e)&&!j(e.getTime()),X=e=>{if(!b(e))return;const t=e.replace(/-/g,"/");return new Date(t)},K=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(!Y(o))return;const[,i,s,a]=n,c=parseInt(s,10),l=parseInt(a,10),u=(e,t)=>"+"===i?e-t:e+t;return o.setHours(u(o.getHours(),c)),o.setMinutes(u(o.getMinutes(),l)),o};function J(e){const t=new Date(e);if(Y(t))return t;const n=X(e);if(Y(n))return n;const r=K(e);if(Y(r))return r;throw new SyntaxError(`${e.toString()} 不是一个合法的日期描述`)}function Z(e){const t=J(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)}const Q=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("/")},ee=(e,...t)=>Q([e,...t].join("/"));function te(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 ne=e=>b(e)?e:x(e)?String(e):w(e)?e?"true":"false":$(e)?e.toISOString():null;function re(e,t=ne){const n=new URLSearchParams;return O(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 oe=(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:c,hash:l,search:u,pathname:d}=n,f=ee("/",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:c,hash:l,search:u,searchParams:te(p),query:p,pathname:f,path:`${f}${u}`,href:e}},ie=e=>{const{protocol:t,auth:n,host:r,pathname:o,searchParams:i,hash:s}=e,a=n?`${n}@`:"",c=re(i),l=c?`?${c}`:"";let u=s.replace(/^#/,"");return u=u?"#"+u:"",`${t}//${a}${r}${o}${l}${u}`},se=(e,t)=>{const n=oe(e);return Object.assign(n.searchParams,t),ie(n)};function ae(e,t,n){const 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),C(n)&&n()}))}function ce(e,t,n){const r=URL.createObjectURL(e);ae(r,t),setTimeout((()=>{URL.revokeObjectURL(r),C(n)&&n()}))}function le(){return!!document.createElement("canvas").getContext}function ue({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 de(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 fe=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),he=`${M}${B}${P}`;const pe=`${M}${B}${P}`,ge="undefined"!=typeof BigInt,me=()=>de("JSBI"),ye=e=>ge?BigInt(e):me().BigInt(e);function be(e,t=pe){if(t.length<2)throw new Error("进制池长度不能少于 2");if(!ge)throw new Error('需要安装 jsbi 模块并将 JSBI 设置为全局变量:\nimport JSBI from "jsbi"; window.JSBI = JSBI;');let n=ye(e);const r=[],{length:o}=t,i=ye(o),s=()=>{const e=Number(((e,t)=>ge?e%t:me().remainder(e,t))(n,i));n=((e,t)=>ge?e/t:me().divide(e,t))(n,i),r.unshift(t[e]),n>0&&s()};return s(),r.join("")}const we=(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),c=0;for(;a>=r&&c<s-1;)a/=r,c++;const l=a.toFixed(o),u=t[c];return String(l)+i+u};function xe(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 Se=0,Ae=0;const Ee=(e=18)=>{const t=Date.now();e=Math.max(e,18),t!==Ae&&(Ae=t,Se=0);const n=`${t}`;let r="";const o=e-5-13;if(o>0){r=`${fe(10**(o-1),10**o-1)}`}const i=((e,t=2)=>String(e).padStart(t,"0"))(Se,5);return Se++,`${n}${r}${i}`},ve=e=>e[fe(0,e.length-1)];function Fe(e,t,n){let r=250,o=13;const i=e.children[0];q(t,12)<230?(i.style.maxWidth=q(t,12)+20+50+"px",r=n.clientX+(q(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 Ce={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)Fe(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&&(Fe(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,n=document.querySelector("#customTitle1494304949567");t&&n&&t.removeChild(n)}},je={keyField:"key",childField:"children",pidField:"pid"},$e={childField:"children",nameField:"name",removeEmptyChild:!1,ignoreCase:!0};const Te=(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)},Re=(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),(Te(e,o)+Te(t,o))/o};const Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Oe=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;function Ne(e){let t,n,r,o,i="",s=0;const a=(e=String(e)).length,c=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+=Ie.charAt(t>>18&63)+Ie.charAt(t>>12&63)+Ie.charAt(t>>6&63)+Ie.charAt(63&t)}return c?i.slice(0,c-3)+"===".substring(c):i}function De(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Oe.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=Ie.indexOf(e.charAt(i++))<<18|Ie.indexOf(e.charAt(i++))<<12|(n=Ie.indexOf(e.charAt(i++)))<<6|(r=Ie.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 ke=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Le=/^(?:(?:\+|00)86)?1\d{10}$/,Me=/^(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]$/,Pe=/^(https?|ftp):\/\/([^\s/$.?#].[^\s]*)$/i,Be=/^https?:\/\/([^\s/$.?#].[^\s]*)$/i,Ue=/^(?:(?:\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])$/,He=/^(([\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,ze=/^(-?[1-9]\d*|0)$/,We=e=>ze.test(e),qe=/^-?([1-9]\d*|0)\.\d*[1-9]$/,_e=e=>qe.test(e),Ge=/^\d+$/;function Ve(e){return[...new Set(e.trim().split(""))].join("")}function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t){return new RegExp(`${Ye(e.trim())}\\s*([^${Ye(Ve(e))}${Ye(Ve(t))}\\s]*)\\s*${t.trim()}`,"g")}function Ke(e,t,n=new WeakMap){if(Object.is(e,t))return!0;const r=Object.prototype.toString.call(e);if(r!==Object.prototype.toString.call(t))return!1;if(v(e)&&v(t)){if(n.has(e))return n.get(e)===t;n.set(e,t),n.set(t,e)}switch(r){case"[object Date]":return e.getTime()===t.getTime();case"[object RegExp]":return e.toString()===t.toString();case"[object Map]":return function(e,t,n){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Ke(o,t.get(r),n))return!1;return!0}(e,t,n);case"[object Set]":return function(e,t,n){if(e.size!==t.size)return!1;for(const r of e){let e=!1;for(const o of t)if(Ke(r,o,n)){e=!0;break}if(!e)return!1}return!0}(e,t,n);case"[object ArrayBuffer]":return function(e,t){return e.byteLength===t.byteLength&&new DataView(e).getInt32(0)===new DataView(t).getInt32(0)}(e,t);case"[object DataView]":return function(e,t,n){return e.byteLength===t.byteLength&&Ke(new Uint8Array(e.buffer),new Uint8Array(t.buffer),n)}(e,t,n);case"[object Int8Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Int16Array]":case"[object Uint16Array]":case"[object Int32Array]":case"[object Uint32Array]":case"[object Float32Array]":case"[object Float64Array]":return function(e,t,n){return e.byteLength===t.byteLength&&Ke(Array.from(e),Array.from(t),n)}(e,t,n);case"[object Object]":return Je(e,t,n);case"[object Array]":return function(e,t,n){const r=Object.keys(e).map(Number),o=Object.keys(t).map(Number);if(r.length!==o.length)return!1;for(let r=0,o=e.length;r<o;r++)if(!Ke(e[r],t[r],n))return!1;return Je(e,t,n)}(e,t,n)}return!1}function Je(e,t,n){const r=Reflect.ownKeys(e),o=Reflect.ownKeys(t);if(r.length!==o.length)return!1;for(const i of r){if(!o.includes(i))return!1;if(!Ke(e[i],t[i],n))return!1}return Object.getPrototypeOf(e)===Object.getPrototypeOf(t)}e.EMAIL_REGEX=ke,e.HEX_POOL=pe,e.HTTP_URL_REGEX=Be,e.IPV4_REGEX=Ue,e.IPV6_REGEX=He,e.PHONE_REGEX=Le,e.STRING_ARABIC_NUMERALS=M,e.STRING_LOWERCASE_ALPHA=P,e.STRING_POOL=he,e.STRING_UPPERCASE_ALPHA=B,e.UNIQUE_NUMBER_SAFE_LENGTH=18,e.URL_REGEX=Pe,e.add=Re,e.addClass=function(e,t){z(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 c,l=0,u=0;const d=()=>{if(c)return o(c);const n=i.next();if(n.done)return void(l===e.length&&r(a));const s=u++;t(n.value,s,e).then((e=>{l++,a[s]=e,d()})).catch((e=>{c=e,d()}))};for(let e=0;e<s;e++)d()}))},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)),c=new Date(a);return c.getFullYear()+i+String(c.getMonth()+1).padStart(2,"0")+i+String(c.getDate()).padStart(2,"0")+" "+String(c.getHours()).padStart(2,"0")+s+String(c.getMinutes()).padStart(2,"0")+s+String(c.getSeconds()).padStart(2,"0")},e.chooseLocalFile=function(e,t){const 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)))}},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(!le())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,c=r;if(r)c=r;else if(t instanceof File){const e=+parseInt((t.size/1024).toFixed(2));c=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:c})))):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 l=document.createElement("canvas"),u=l.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}=ue({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}=ue({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}=ue({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}=ue({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}=ue({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});l.width=h,l.height=p,u.clearRect(0,0,h,p),u.drawImage(s,0,0,h,p);const g=l.toDataURL(o,c),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=>V(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=V,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=>{G(e,t)})):G(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)ce(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=J,e.dateToEnd=function(e){const t=Z(e);return t.setDate(t.getDate()+1),J(t.getTime()-1)},e.dateToStart=Z,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.decodeFromBase64=function(e){const t=E(de("atob"))?De(e):de("atob")(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return E(de("TextDecoder"))?function(e){const t=String.fromCharCode.apply(null,e);return decodeURIComponent(t)}(r):new(de("TextDecoder"))("utf-8").decode(r)},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=ce,e.downloadData=function(e,t,n,r){if(n=n.replace(`.${t}`,"")+`.${t}`,"json"===t){ce(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"}));ae("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=ae,e.downloadURL=function(e,t){window.open(t?se(e,t):e)},e.encodeToBase64=function(e){const t=E(de("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(de("TextEncoder"))).encode(e);let n="";const r=t.length;for(let e=0;e<r;e++)n+=String.fromCharCode(t[e]);return E(de("btoa"))?Ne(n):de("btoa")(n)},e.escapeRegExp=Ye,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=G,e.flatTree=function e(t,n=je){const{keyField:r="key",childField:o="children",pidField:i="pid"}=v(n)?n:{};let s=[];for(let a=0,c=t.length;a<c;a++){const c=t[a],l={...c,[o]:[]};if(g(l,o)&&delete l[o],s.push(l),c[o]){const t=c[o].map((e=>({...e,[i]:c[r]||e.pid})));s=s.concat(e(t,n))}}return s},e.forEachDeep=function(e,t,n={childField:"children",reverse:!1,breadthFirst:!1}){const{childField:r="children",reverse:o=!1,breadthFirst:i=!1}=v(n)?n:{};let s=!1;const a=[],c=(n,l,u=0)=>{if(o){for(let o=n.length-1;o>=0&&!s;o--){const d=n[o];if(i)a.push({item:d,index:o,array:n,tree:e,parent:l,level:u});else{const i=t(d,o,n,e,l,u);if(!1===i){s=!0;break}if(!0===i)continue;d&&Array.isArray(d[r])&&c(d[r],d,u+1)}}if(i)for(;!s;){const e=a.shift(),{item:n,index:o,array:i,tree:l,parent:u,level:d}=e,f=t(n,o,i,l,u,d);if(!1===f){s=!0;break}!0!==f&&(n&&Array.isArray(n[r])&&c(n[r],n,d+1))}}else{for(let o=0,d=n.length;o<d&&!s;o++){const d=n[o];if(i)a.push({item:d,index:o,array:n,tree:e,parent:l,level:u});else{const i=t(d,o,n,e,l,u);if(!1===i){s=!0;break}if(!0===i)continue;d&&Array.isArray(d[r])&&c(d[r],d,u+1)}}if(i)for(;!s;){const e=a.shift();if(!e)break;const{item:n,index:o,array:i,tree:l,parent:u,level:d}=e,f=t(n,o,i,l,u,d);if(!1===f){s=!0;break}!0!==f&&(n&&Array.isArray(n[r])&&c(n[r],n,d+1))}}};c(e,null,0),e=null},e.formatDate=function(e,t="YYYY-MM-DD HH:mm:ss"){const n=J(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=xe,e.formatNumber=xe,e.formatTree=function(e,t=je){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=$e){if(!g(n,"filter")&&(!g(n,"keyword")||T(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:c="20px PingFangSC-Medium,PingFang SC",fillStyle:l="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=c,g.fillStyle=l,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(){const o=document.querySelector(`#${f}`);if(o){const{opacity:i,zIndex:s,display:a,visibility:c}=(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"!==c)&&(r.disconnect(),r=null,h.removeChild(o),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.getGlobal=de,e.getStrWidthPx=q,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 we(e,a,{ratio:r?1e3:1024,decimals:n,separator:o})},e.isArray=F,e.isBigInt=e=>"bigint"==typeof e,e.isBoolean=w,e.isDate=$,e.isDigit=e=>Ge.test(e),e.isEmail=e=>ke.test(e),e.isEmpty=T,e.isEqual=function(e,t){return Ke(e,t)},e.isError=e=>"Error"===y(e),e.isFloat=_e,e.isFunction=C,e.isIdNo=e=>{if(!Me.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=We,e.isIpV4=e=>Ue.test(e),e.isIpV6=e=>He.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=j,e.isNull=A,e.isNullOrUnDef=E,e.isNullish=E,e.isNumber=x,e.isNumerical=e=>We(e)||_e(e),e.isObject=v,e.isPhone=e=>Le.test(e),e.isPlainObject=I,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?Pe:Be).test(e),e.isValidDate=Y,e.mapDeep=function(e,t,n="children",r=!1){let o=!1;const i=[],s=(i,a,c,l=0)=>{if(r)for(let r=i.length-1;r>=0&&!o;r--){const u=t(i[r],r,i,e,a,l);if(!1===u){o=!0;break}!0!==u&&(c.push(N(u,[n])),i[r]&&Array.isArray(i[r][n])?(c[c.length-1][n]=[],s(i[r][n],i[r],c[c.length-1][n],l+1)):delete u[n])}else for(let r=0;r<i.length&&!o;r++){const u=t(i[r],r,i,e,a,l);if(!1===u){o=!0;break}!0!==u&&(c.push(N(u,[n])),i[r]&&Array.isArray(i[r][n])?(c[c.length-1][n]=[],s(i[r][n],i[r],c[c.length-1][n],l+1)):delete u[n])}};return s(e,null,i),e=null,i},e.multiply=Te,e.numberAbbr=we,e.numberToHex=be,e.objectAssign=k,e.objectEach=O,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 O(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=k,e.objectOmit=N,e.objectPick=function(e,t){const n={};return O(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(Xe(t,n))).map((e=>E(e)?void 0:e[1]))},e.pathJoin=ee,e.pathNormalize=Q,e.qsParse=te,e.qsStringify=re,e.randomNumber=fe,e.randomString=(e,t)=>{let n=0,r=he;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[fe(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=fe(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){z(t,(t=>e.classList.remove(t)))},e.replaceVarFromString=function(e,t,n="{",r="}"){return e.replace(new RegExp(Xe(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){const{children:r="children",id:o="id"}=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],c=[s];for(;n&&n.parentId;)a=[n.parentId,...a],c=[n.parent,...c],n=e.find((e=>e[o]===n.parentId));return[a,c]})(i(e))},e.select=_,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=W,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}=k(r,e),c=document.documentElement,l=document.body,u=o===window||o===document||o===c||o===l?[c,l]:[o];let f;const h=(()=>{let e=0;return t(u,(t=>{if("scrollTop"in t)return e=t.scrollTop,!1})),e})(),p=i-h,g=function(e){let t;if(F(e))t=d(...e);else{const n=R[e];if(!n)throw new Error(`${e} 缓冲函数未定义`);t=d(...n)}return e=>t(Math.max(0,Math.min(e,1)))}(a),m=()=>{const e=performance.now(),t=(f?e-f:0)/s,r=g(t);var o;f||(f=e),o=h+p*r,u.forEach((e=>{"scrollTop"in e&&(e.scrollTop=o)})),t>=1?n():requestAnimationFrame(m)};m()}))},e.stringAssign=(e,t)=>e.replace(H,((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={"&":"&","<":"<",">":">",'"':"""};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(U,(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)=>Re(e,-t),e.supportCanvas=le,e.throttle=(e,t,n)=>{let r,o=!1,i=0;const s=function(...s){if(o)return;const a=Date.now(),c=()=>{i=a,e.call(this,...s)};if(0===i)return n?c():void(i=a);i+t-a>0?(clearTimeout(r),r=setTimeout((()=>c()),t)):c()};return s.cancel=()=>{clearTimeout(r),o=!0},s},e.tooltipEvent=Ce,e.typeIs=y,e.uniqueNumber=Ee,e.uniqueString=(e,t)=>{let n=0,r=pe;b(t)?(n=e,r=t):x(e)?n=e:b(e)&&(r=e);let o=be(Ee(),r),i=n-o.length;if(i<=0)return o;for(;i--;)o+=ve(r);return o},e.uniqueSymbol=Ve,e.urlDelParams=(e,t)=>{const n=oe(e);return t.forEach((e=>delete n.searchParams[e])),ie(n)},e.urlParse=oe,e.urlSetParams=se,e.urlStringify=ie,e.wait=function(e=1){return new Promise((t=>setTimeout(t,e)))},e.weAtob=De,e.weBtoa=Ne}));
|
|
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 c(e,t,n){return((i(t,n)*e+s(t,n))*e+a(t))*e}function l(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]=c(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=l(a,e,n);return u>=.001?function(e,t,n,r){for(var o=0;o<4;++o){var i=l(t,n,r);if(0===i)return t;t-=(c(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=c(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:c(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,j=e=>Number.isNaN(e),$=e=>"Date"===y(e);function T(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}const R={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]};const I=e=>{if(!v(e))return!1;const t=Object.getPrototypeOf(e);return!t||t===Object.prototype};function O(e,t){for(const n in e)if(g(e,n)&&!1===t(e[n],n))break;e=null}function N(e,t){const n={};return O(e,((e,r)=>{t.includes(r)||(n[r]=e)})),e=null,n}const k=(e,t,n)=>{if(S(n))return t;if(y(t)!==y(n))return F(n)?k(e,[],n):v(n)?k(e,{},n):n;if(I(n)){const r=e.get(n);return r||(e.set(n,t),O(n,((n,r)=>{t[r]=k(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]=k(e,t[r],n)})),t)}return n};function D(e,...t){const n=new Map;for(let r=0,o=t.length;r<o;r++){const o=t[r];e=k(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 M="0123456789",P="abcdefghijklmnopqrstuvwxyz",B="ABCDEFGHIJKLMNOPQRSTUVWXYZ",U=/%[%sdo]/g;const H=/\${(.*?)}/g;const z=(e,t)=>{e.split(/\s+/g).forEach(t)};const W=(e,t,n)=>{v(t)?O(t,((t,n)=>{W(e,n,t)})):e.style.setProperty(L(t),n)};function q(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 _(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 G(e,t){const{successCallback:n,failCallback:r,container:o=document.body}=E(t)?{}:t,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),_(i);try{document.execCommand("copy")&&C(n)&&n()}catch(e){C(r)&&r(e)}finally{o.removeChild(i),window.getSelection()?.removeAllRanges()}}function V(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 $(n)&&r.push([o,n.toUTCString()]);r.push(["path","/"]),document.cookie=r.map((e=>{const[t,n]=e;return`${t}=${n}`})).join(";")}const Y=e=>$(e)&&!j(e.getTime()),X=e=>{if(!b(e))return;const t=e.replace(/-/g,"/");return new Date(t)},K=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(!Y(o))return;const[,i,s,a]=n,c=parseInt(s,10),l=parseInt(a,10),u=(e,t)=>"+"===i?e-t:e+t;return o.setHours(u(o.getHours(),c)),o.setMinutes(u(o.getMinutes(),l)),o};function J(e){const t=new Date(e);if(Y(t))return t;const n=X(e);if(Y(n))return n;const r=K(e);if(Y(r))return r;throw new SyntaxError(`${e.toString()} 不是一个合法的日期描述`)}function Z(e){const t=J(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)}const Q=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("/")},ee=(e,...t)=>Q([e,...t].join("/"));function te(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 ne=e=>b(e)?e:x(e)?String(e):w(e)?e?"true":"false":$(e)?e.toISOString():null;function re(e,t=ne){const n=new URLSearchParams;return O(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 oe=(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:c,hash:l,search:u,pathname:d}=n,f=ee("/",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:c,hash:l,search:u,searchParams:te(p),query:p,pathname:f,path:`${f}${u}`,href:e}},ie=e=>{const{protocol:t,auth:n,host:r,pathname:o,searchParams:i,hash:s}=e,a=n?`${n}@`:"",c=re(i),l=c?`?${c}`:"";let u=s.replace(/^#/,"");return u=u?"#"+u:"",`${t}//${a}${r}${o}${l}${u}`},se=(e,t)=>{const n=oe(e);return Object.assign(n.searchParams,t),ie(n)};function ae(e,t,n){const 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),C(n)&&n()}))}function ce(e,t,n){const r=URL.createObjectURL(e);ae(r,t),setTimeout((()=>{URL.revokeObjectURL(r),C(n)&&n()}))}function le(){return!!document.createElement("canvas").getContext}function ue({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 de(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 fe=(e,t)=>Math.floor(Math.random()*(t-e+1)+e),he=`${M}${B}${P}`;const pe=`${M}${B}${P}`,ge="undefined"!=typeof BigInt,me=()=>de("JSBI"),ye=e=>ge?BigInt(e):me().BigInt(e);function be(e,t=pe){if(t.length<2)throw new Error("进制池长度不能少于 2");if(!ge)throw new Error('需要安装 jsbi 模块并将 JSBI 设置为全局变量:\nimport JSBI from "jsbi"; window.JSBI = JSBI;');let n=ye(e);const r=[],{length:o}=t,i=ye(o),s=()=>{const e=Number(((e,t)=>ge?e%t:me().remainder(e,t))(n,i));n=((e,t)=>ge?e/t:me().divide(e,t))(n,i),r.unshift(t[e]),n>0&&s()};return s(),r.join("")}const we=(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),c=0;for(;a>=r&&c<s-1;)a/=r,c++;const l=a.toFixed(o),u=t[c];return String(l)+i+u};function xe(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 Se=0,Ae=0;const Ee=(e=18)=>{const t=Date.now();e=Math.max(e,18),t!==Ae&&(Ae=t,Se=0);const n=`${t}`;let r="";const o=e-5-13;if(o>0){r=`${fe(10**(o-1),10**o-1)}`}const i=((e,t=2)=>String(e).padStart(t,"0"))(Se,5);return Se++,`${n}${r}${i}`},ve=e=>e[fe(0,e.length-1)];function Fe(e,t,n){let r=250,o=13;const i=e.children[0];q(t,12)<230?(i.style.maxWidth=q(t,12)+20+50+"px",r=n.clientX+(q(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 Ce={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)Fe(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&&(Fe(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,n=document.querySelector("#customTitle1494304949567");t&&n&&t.removeChild(n)}},je={keyField:"key",childField:"children",pidField:"pid"},$e={childField:"children",nameField:"name",removeEmptyChild:!1,ignoreCase:!0};const Te=(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)},Re=(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),(Te(e,o)+Te(t,o))/o};const Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Oe=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;function Ne(e){let t,n,r,o,i="",s=0;const a=(e=String(e)).length,c=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+=Ie.charAt(t>>18&63)+Ie.charAt(t>>12&63)+Ie.charAt(t>>6&63)+Ie.charAt(63&t)}return c?i.slice(0,c-3)+"===".substring(c):i}function ke(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!Oe.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=Ie.indexOf(e.charAt(i++))<<18|Ie.indexOf(e.charAt(i++))<<12|(n=Ie.indexOf(e.charAt(i++)))<<6|(r=Ie.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 De=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Le=/^(?:(?:\+|00)86)?1\d{10}$/,Me=/^(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]$/,Pe=/^(https?|ftp):\/\/([^\s/$.?#].[^\s]*)$/i,Be=/^https?:\/\/([^\s/$.?#].[^\s]*)$/i,Ue=/^(?:(?:\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])$/,He=/^(([\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,ze=/^(-?[1-9]\d*|0)$/,We=e=>ze.test(e),qe=/^-?([1-9]\d*|0)\.\d*[1-9]$/,_e=e=>qe.test(e),Ge=/^\d+$/;function Ve(e){return[...new Set(e.trim().split(""))].join("")}function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t){return new RegExp(`${Ye(e.trim())}\\s*([^${Ye(Ve(e))}${Ye(Ve(t))}\\s]*)\\s*${t.trim()}`,"g")}function Ke(e,t,n=new WeakMap){if(Object.is(e,t))return!0;const r=Object.prototype.toString.call(e);if(r!==Object.prototype.toString.call(t))return!1;if(v(e)&&v(t)){if(n.has(e))return n.get(e)===t;n.set(e,t),n.set(t,e)}switch(r){case"[object Date]":return e.getTime()===t.getTime();case"[object RegExp]":return e.toString()===t.toString();case"[object Map]":return function(e,t,n){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Ke(o,t.get(r),n))return!1;return!0}(e,t,n);case"[object Set]":return function(e,t,n){if(e.size!==t.size)return!1;for(const r of e){let e=!1;for(const o of t)if(Ke(r,o,n)){e=!0;break}if(!e)return!1}return!0}(e,t,n);case"[object ArrayBuffer]":return function(e,t){return e.byteLength===t.byteLength&&new DataView(e).getInt32(0)===new DataView(t).getInt32(0)}(e,t);case"[object DataView]":return function(e,t,n){return e.byteLength===t.byteLength&&Ke(new Uint8Array(e.buffer),new Uint8Array(t.buffer),n)}(e,t,n);case"[object Int8Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Int16Array]":case"[object Uint16Array]":case"[object Int32Array]":case"[object Uint32Array]":case"[object Float32Array]":case"[object Float64Array]":return function(e,t,n){return e.byteLength===t.byteLength&&Ke(Array.from(e),Array.from(t),n)}(e,t,n);case"[object Object]":return Je(e,t,n);case"[object Array]":return function(e,t,n){const r=Object.keys(e).map(Number),o=Object.keys(t).map(Number);if(r.length!==o.length)return!1;for(let r=0,o=e.length;r<o;r++)if(!Ke(e[r],t[r],n))return!1;return Je(e,t,n)}(e,t,n)}return!1}function Je(e,t,n){const r=Reflect.ownKeys(e),o=Reflect.ownKeys(t);if(r.length!==o.length)return!1;for(const i of r){if(!o.includes(i))return!1;if(!Ke(e[i],t[i],n))return!1}return Object.getPrototypeOf(e)===Object.getPrototypeOf(t)}e.EMAIL_REGEX=De,e.HEX_POOL=pe,e.HTTP_URL_REGEX=Be,e.IPV4_REGEX=Ue,e.IPV6_REGEX=He,e.PHONE_REGEX=Le,e.STRING_ARABIC_NUMERALS=M,e.STRING_LOWERCASE_ALPHA=P,e.STRING_POOL=he,e.STRING_UPPERCASE_ALPHA=B,e.UNIQUE_NUMBER_SAFE_LENGTH=18,e.URL_REGEX=Pe,e.add=Re,e.addClass=function(e,t){z(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 c,l=0,u=0;const d=()=>{if(c)return o(c);const n=i.next();if(n.done)return void(l===e.length&&r(a));const s=u++;t(n.value,s,e).then((e=>{l++,a[s]=e,d()})).catch((e=>{c=e,d()}))};for(let e=0;e<s;e++)d()}))},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)),c=new Date(a);return c.getFullYear()+i+String(c.getMonth()+1).padStart(2,"0")+i+String(c.getDate()).padStart(2,"0")+" "+String(c.getHours()).padStart(2,"0")+s+String(c.getMinutes()).padStart(2,"0")+s+String(c.getSeconds()).padStart(2,"0")},e.chooseLocalFile=function(e,t){const 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)))}},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(!le())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,c=r;if(r)c=r;else if(t instanceof File){const e=+parseInt((t.size/1024).toFixed(2));c=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:c})))):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 l=document.createElement("canvas"),u=l.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}=ue({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}=ue({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}=ue({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}=ue({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}=ue({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});l.width=h,l.height=p,u.clearRect(0,0,h,p),u.drawImage(s,0,0,h,p);const g=l.toDataURL(o,c),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=>V(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=V,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=>{G(e,t)})):G(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)ce(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=J,e.dateToEnd=function(e){const t=Z(e);return t.setDate(t.getDate()+1),J(t.getTime()-1)},e.dateToStart=Z,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.decodeFromBase64=function(e){const t=E(de("atob"))?ke(e):de("atob")(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return E(de("TextDecoder"))?function(e){const t=String.fromCharCode.apply(null,e);return decodeURIComponent(t)}(r):new(de("TextDecoder"))("utf-8").decode(r)},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=ce,e.downloadData=function(e,t,n,r){if(n=n.replace(`.${t}`,"")+`.${t}`,"json"===t){ce(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"}));ae("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=ae,e.downloadURL=function(e,t){window.open(t?se(e,t):e)},e.encodeToBase64=function(e){const t=E(de("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(de("TextEncoder"))).encode(e);let n="";const r=t.length;for(let e=0;e<r;e++)n+=String.fromCharCode(t[e]);return E(de("btoa"))?Ne(n):de("btoa")(n)},e.escapeRegExp=Ye,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=G,e.flatTree=function e(t,n=je){const{keyField:r="key",childField:o="children",pidField:i="pid"}=v(n)?n:{};let s=[];for(let a=0,c=t.length;a<c;a++){const c=t[a],l={...c,[o]:[]};if(g(l,o)&&delete l[o],s.push(l),c[o]){const t=c[o].map((e=>({...e,[i]:c[r]||e.pid})));s=s.concat(e(t,n))}}return s},e.forEachDeep=function(e,t,n={childField:"children",reverse:!1,breadthFirst:!1}){const{childField:r="children",reverse:o=!1,breadthFirst:i=!1}=v(n)?n:{};let s=!1;const a=[],c=(n,l,u=0)=>{if(o){for(let o=n.length-1;o>=0&&!s;o--){const d=n[o];if(i)a.push({item:d,index:o,array:n,tree:e,parent:l,level:u});else{const i=t(d,o,n,e,l,u);if(!1===i){s=!0;break}if(!0===i)continue;d&&Array.isArray(d[r])&&c(d[r],d,u+1)}}if(i)for(;a.length>0&&!s;){const e=a.shift(),{item:n,index:o,array:i,tree:l,parent:u,level:d}=e,f=t(n,o,i,l,u,d);if(!1===f){s=!0;break}!0!==f&&(n&&Array.isArray(n[r])&&c(n[r],n,d+1))}}else{for(let o=0,d=n.length;o<d&&!s;o++){const d=n[o];if(i)a.push({item:d,index:o,array:n,tree:e,parent:l,level:u});else{const i=t(d,o,n,e,l,u);if(!1===i){s=!0;break}if(!0===i)continue;d&&Array.isArray(d[r])&&c(d[r],d,u+1)}}if(i)for(;a.length>0&&!s;){const e=a.shift();if(!e)break;const{item:n,index:o,array:i,tree:l,parent:u,level:d}=e,f=t(n,o,i,l,u,d);if(!1===f){s=!0;break}!0!==f&&(n&&Array.isArray(n[r])&&c(n[r],n,d+1))}}};c(e,null,0),e=null},e.formatDate=function(e,t="YYYY-MM-DD HH:mm:ss"){const n=J(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=xe,e.formatNumber=xe,e.formatTree=function(e,t=je){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=$e){if(!g(n,"filter")&&(!g(n,"keyword")||T(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:c="20px PingFangSC-Medium,PingFang SC",fillStyle:l="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=c,g.fillStyle=l,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(){const o=document.querySelector(`#${f}`);if(o){const{opacity:i,zIndex:s,display:a,visibility:c}=(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"!==c)&&(r.disconnect(),r=null,h.removeChild(o),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.getGlobal=de,e.getStrWidthPx=q,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 we(e,a,{ratio:r?1e3:1024,decimals:n,separator:o})},e.isArray=F,e.isBigInt=e=>"bigint"==typeof e,e.isBoolean=w,e.isDate=$,e.isDigit=e=>Ge.test(e),e.isEmail=e=>De.test(e),e.isEmpty=T,e.isEqual=function(e,t){return Ke(e,t)},e.isError=e=>"Error"===y(e),e.isFloat=_e,e.isFunction=C,e.isIdNo=e=>{if(!Me.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=We,e.isIpV4=e=>Ue.test(e),e.isIpV6=e=>He.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=j,e.isNull=A,e.isNullOrUnDef=E,e.isNullish=E,e.isNumber=x,e.isNumerical=e=>We(e)||_e(e),e.isObject=v,e.isPhone=e=>Le.test(e),e.isPlainObject=I,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?Pe:Be).test(e),e.isValidDate=Y,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,c,l=0)=>{if(o)for(let o=n.length-1;o>=0&&!i;o--){const u=n[o],d=t(u,o,n,e,s,l);if(!1===d){i=!0;break}!0!==d&&(c.push(N(d,[r])),u&&Array.isArray(u[r])?(c[c.length-1][r]=[],a(u[r],u,c[c.length-1][r],l+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,l);if(!1===d){i=!0;break}!0!==d&&(c.push(N(d,[r])),u&&Array.isArray(u[r])?(c[c.length-1][r]=[],a(u[r],u,c[c.length-1][r],l+1)):delete d[r])}};return a(e,null,s),e=null,s},e.multiply=Te,e.numberAbbr=we,e.numberToHex=be,e.objectAssign=D,e.objectEach=O,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 O(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=D,e.objectOmit=N,e.objectPick=function(e,t){const n={};return O(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(Xe(t,n))).map((e=>E(e)?void 0:e[1]))},e.pathJoin=ee,e.pathNormalize=Q,e.qsParse=te,e.qsStringify=re,e.randomNumber=fe,e.randomString=(e,t)=>{let n=0,r=he;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[fe(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=fe(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){z(t,(t=>e.classList.remove(t)))},e.replaceVarFromString=function(e,t,n="{",r="}"){return e.replace(new RegExp(Xe(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],c=[s];for(;n&&n.parentId;)a=[n.parentId,...a],c=[n.parent,...c],n=e.find((e=>e[o]===n.parentId));return[a,c]})(i(e))},e.select=_,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=W,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}=D(r,e),c=document.documentElement,l=document.body,u=o===window||o===document||o===c||o===l?[c,l]:[o];let f;const h=(()=>{let e=0;return t(u,(t=>{if("scrollTop"in t)return e=t.scrollTop,!1})),e})(),p=i-h,g=function(e){let t;if(F(e))t=d(...e);else{const n=R[e];if(!n)throw new Error(`${e} 缓冲函数未定义`);t=d(...n)}return e=>t(Math.max(0,Math.min(e,1)))}(a),m=()=>{const e=performance.now(),t=(f?e-f:0)/s,r=g(t);var o;f||(f=e),o=h+p*r,u.forEach((e=>{"scrollTop"in e&&(e.scrollTop=o)})),t>=1?n():requestAnimationFrame(m)};m()}))},e.stringAssign=(e,t)=>e.replace(H,((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={"&":"&","<":"<",">":">",'"':"""};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(U,(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)=>Re(e,-t),e.supportCanvas=le,e.throttle=(e,t,n)=>{let r,o=!1,i=0;const s=function(...s){if(o)return;const a=Date.now(),c=()=>{i=a,e.call(this,...s)};if(0===i)return n?c():void(i=a);i+t-a>0?(clearTimeout(r),r=setTimeout((()=>c()),t)):c()};return s.cancel=()=>{clearTimeout(r),o=!0},s},e.tooltipEvent=Ce,e.typeIs=y,e.uniqueNumber=Ee,e.uniqueString=(e,t)=>{let n=0,r=pe;b(t)?(n=e,r=t):x(e)?n=e:b(e)&&(r=e);let o=be(Ee(),r),i=n-o.length;if(i<=0)return o;for(;i--;)o+=ve(r);return o},e.uniqueSymbol=Ve,e.urlDelParams=(e,t)=>{const n=oe(e);return t.forEach((e=>delete n.searchParams[e])),ie(n)},e.urlParse=oe,e.urlSetParams=se,e.urlStringify=ie,e.wait=function(e=1){return new Promise((t=>setTimeout(t,e)))},e.weAtob=ke,e.weBtoa=Ne}));
|