@vef-framework/shared 2.0.11 → 2.1.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 (115) hide show
  1. package/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
  2. package/dist/cjs/color/color-ops.cjs +1 -1
  3. package/dist/cjs/color/index.cjs +1 -1
  4. package/dist/cjs/color/name.cjs +1 -1
  5. package/dist/cjs/color/palette.cjs +1 -1
  6. package/dist/cjs/constants/color-names.cjs +1 -1
  7. package/dist/cjs/constants/color-palettes.cjs +1 -1
  8. package/dist/cjs/constants/index.cjs +1 -1
  9. package/dist/cjs/index.cjs +1 -1
  10. package/dist/cjs/types/color.cjs +0 -1
  11. package/dist/cjs/types/common.cjs +0 -1
  12. package/dist/cjs/types/deep-keys.cjs +0 -1
  13. package/dist/cjs/types/index.cjs +0 -1
  14. package/dist/cjs/utils/chrono.cjs +1 -1
  15. package/dist/cjs/utils/equal.cjs +1 -1
  16. package/dist/cjs/utils/error.cjs +2 -3
  17. package/dist/cjs/utils/event.cjs +1 -1
  18. package/dist/cjs/utils/format.cjs +1 -1
  19. package/dist/cjs/utils/function.cjs +1 -1
  20. package/dist/cjs/utils/id.cjs +1 -1
  21. package/dist/cjs/utils/index.cjs +1 -1
  22. package/dist/cjs/utils/key.cjs +1 -1
  23. package/dist/cjs/utils/lib.cjs +1 -1
  24. package/dist/cjs/utils/object.cjs +1 -1
  25. package/dist/cjs/utils/path.cjs +1 -1
  26. package/dist/cjs/utils/pinyin.cjs +1 -1
  27. package/dist/cjs/utils/security.cjs +1 -1
  28. package/dist/cjs/utils/string.cjs +1 -1
  29. package/dist/cjs/utils/table.cjs +1 -1
  30. package/dist/cjs/utils/task.cjs +1 -1
  31. package/dist/cjs/utils/tree.cjs +1 -1
  32. package/dist/cjs/utils/zod.cjs +1 -1
  33. package/dist/es/color/color-ops.js +55 -68
  34. package/dist/es/color/index.js +4 -18
  35. package/dist/es/color/name.js +25 -27
  36. package/dist/es/color/palette.js +70 -82
  37. package/dist/es/constants/color-names.js +1572 -1572
  38. package/dist/es/constants/color-palettes.js +1085 -360
  39. package/dist/es/constants/index.js +3 -8
  40. package/dist/es/index.js +25 -167
  41. package/dist/es/types/color.js +1 -1
  42. package/dist/es/types/common.js +1 -1
  43. package/dist/es/types/deep-keys.js +1 -1
  44. package/dist/es/types/index.js +1 -3
  45. package/dist/es/utils/chrono.js +77 -92
  46. package/dist/es/utils/equal.js +83 -118
  47. package/dist/es/utils/error.js +27 -29
  48. package/dist/es/utils/event.js +27 -51
  49. package/dist/es/utils/format.js +27 -18
  50. package/dist/es/utils/function.js +26 -36
  51. package/dist/es/utils/id.js +21 -21
  52. package/dist/es/utils/index.js +18 -81
  53. package/dist/es/utils/key.js +17 -23
  54. package/dist/es/utils/lib.js +8 -64
  55. package/dist/es/utils/object.js +12 -12
  56. package/dist/es/utils/path.js +37 -58
  57. package/dist/es/utils/pinyin.js +41 -43
  58. package/dist/es/utils/security.js +73 -31
  59. package/dist/es/utils/string.js +19 -7
  60. package/dist/es/utils/table.js +13 -13
  61. package/dist/es/utils/task.js +6 -7
  62. package/dist/es/utils/tree.js +159 -181
  63. package/dist/es/utils/zod.js +7 -7
  64. package/dist/types/constants/color-names.d.ts +2 -2
  65. package/dist/types/constants/color-palettes.d.ts +2 -2
  66. package/dist/types/src/color/color-ops.d.ts +84 -0
  67. package/dist/types/src/color/index.d.ts +3 -0
  68. package/dist/types/src/color/name.d.ts +7 -0
  69. package/dist/types/src/color/palette.d.ts +8 -0
  70. package/dist/types/src/constants/color-names.d.ts +11 -0
  71. package/dist/types/src/constants/color-palettes.d.ts +823 -0
  72. package/dist/types/src/constants/index.d.ts +2 -0
  73. package/dist/types/src/index.d.ts +4 -0
  74. package/dist/types/src/types/color.d.ts +25 -0
  75. package/dist/types/src/types/common.d.ts +29 -0
  76. package/dist/types/src/types/deep-keys.d.ts +37 -0
  77. package/dist/types/src/types/index.d.ts +3 -0
  78. package/dist/types/src/utils/chrono.d.ts +152 -0
  79. package/dist/types/src/utils/equal.d.ts +16 -0
  80. package/dist/types/src/utils/error.d.ts +22 -0
  81. package/dist/types/src/utils/event.d.ts +46 -0
  82. package/dist/types/src/utils/format.d.ts +31 -0
  83. package/dist/types/src/utils/function.d.ts +27 -0
  84. package/dist/types/src/utils/id.d.ts +6 -0
  85. package/dist/types/src/utils/index.d.ts +18 -0
  86. package/dist/types/src/utils/key.d.ts +5 -0
  87. package/dist/types/src/utils/lib.d.ts +5 -0
  88. package/dist/types/src/utils/object.d.ts +9 -0
  89. package/dist/types/src/utils/path.d.ts +13 -0
  90. package/dist/types/src/utils/pinyin.d.ts +40 -0
  91. package/dist/types/src/utils/security.d.ts +60 -0
  92. package/dist/types/src/utils/string.d.ts +15 -0
  93. package/dist/types/src/utils/table.d.ts +25 -0
  94. package/dist/types/src/utils/task.d.ts +4 -0
  95. package/dist/types/src/utils/tree.d.ts +216 -0
  96. package/dist/types/src/utils/zod.d.ts +2 -0
  97. package/dist/types/types/color.d.ts +1 -49
  98. package/dist/types/types/common.d.ts +7 -3
  99. package/dist/types/types/deep-keys.d.ts +28 -0
  100. package/dist/types/utils/chrono.d.ts +3 -13
  101. package/dist/types/utils/error.d.ts +5 -21
  102. package/dist/types/utils/event.d.ts +9 -31
  103. package/dist/types/utils/format.d.ts +0 -2
  104. package/dist/types/utils/function.d.ts +4 -36
  105. package/dist/types/utils/id.d.ts +2 -2
  106. package/dist/types/utils/key.d.ts +2 -4
  107. package/dist/types/utils/path.d.ts +7 -70
  108. package/dist/types/utils/pinyin.d.ts +2 -3
  109. package/dist/types/utils/security.d.ts +44 -2
  110. package/dist/types/utils/string.d.ts +8 -0
  111. package/dist/types/utils/table.d.ts +1 -0
  112. package/dist/types/utils/task.d.ts +1 -3
  113. package/dist/types/utils/tree.d.ts +8 -0
  114. package/dist/types/utils/zod.d.ts +1 -0
  115. package/package.json +13 -13
@@ -1,46 +1,44 @@
1
- import a from "@pinyin-pro/data/modern";
2
- import { addDict as c, pinyin as o } from "pinyin-pro";
3
- import "./lib.js";
4
- import { isString as f } from "radashi";
5
- c(a);
6
- const r = {
7
- type: "array",
8
- toneType: "none",
9
- multiple: !1,
10
- nonZh: "consecutive",
11
- surname: "head"
12
- };
13
- function u(n) {
14
- return o(
15
- n,
16
- {
17
- ...r,
18
- pattern: "pinyin"
19
- }
20
- );
1
+ /*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
2
+ import { isString as e } from "./lib.js";
3
+ import t from "@pinyin-pro/data/modern";
4
+ import { addDict as n, pinyin as r } from "pinyin-pro";
5
+ //#region src/utils/pinyin.ts
6
+ n(t);
7
+ var i = {
8
+ type: "array",
9
+ toneType: "none",
10
+ multiple: !1,
11
+ nonZh: "consecutive",
12
+ surname: "head"
13
+ }, a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
14
+ function s(e) {
15
+ let t = a.get(e);
16
+ if (t) return t;
17
+ let n = r(e, {
18
+ ...i,
19
+ pattern: "pinyin"
20
+ });
21
+ return a.set(e, n), n;
21
22
  }
22
- function m(n) {
23
- return o(
24
- n,
25
- {
26
- ...r,
27
- pattern: "first"
28
- }
29
- );
23
+ function c(e) {
24
+ let t = o.get(e);
25
+ if (t) return t;
26
+ let n = r(e, {
27
+ ...i,
28
+ pattern: "first"
29
+ });
30
+ return o.set(e, n), n;
30
31
  }
31
- function g(n, ...s) {
32
- const i = { ...n };
33
- for (const t of s) {
34
- const e = n[t];
35
- if (f(e)) {
36
- const p = `${t}Pinyin`, y = `${t}PinyinInitials`;
37
- i[p] = u(e).join(""), i[y] = m(e).join("");
38
- }
39
- }
40
- return i;
32
+ function l(t, ...n) {
33
+ let r = { ...t };
34
+ for (let i of n) {
35
+ let n = t[i];
36
+ if (e(n)) {
37
+ let e = `${i}Pinyin`, t = `${i}PinyinInitials`;
38
+ r[e] = s(n).join(""), r[t] = c(n).join("");
39
+ }
40
+ }
41
+ return r;
41
42
  }
42
- export {
43
- u as getPinyin,
44
- m as getPinyinInitials,
45
- g as withPinyin
46
- };
43
+ //#endregion
44
+ export { s as getPinyin, c as getPinyinInitials, l as withPinyin };
@@ -1,31 +1,73 @@
1
- import i from "jsencrypt";
2
- import "./lib.js";
3
- import { isNullish as e } from "radashi";
4
- function a(r, t) {
5
- if (e(r))
6
- throw new Error(`Failed to encrypt data [${r}] using RSA`);
7
- if (!t || t.trim() === "")
8
- throw new Error(`Failed to encrypt data [${r}] using RSA`);
9
- const n = new i();
10
- n.setPublicKey(t);
11
- const o = n.encrypt(r);
12
- if (!o)
13
- throw console.error("Failed to encrypt data using RSA", r), new Error(`Failed to encrypt data [${r}] using RSA`);
14
- return o;
15
- }
16
- function p(r, t) {
17
- if (e(r))
18
- throw new Error(`Failed to decrypt data [${r}] using RSA`);
19
- if (!t || t.trim() === "")
20
- throw new Error(`Failed to decrypt data [${r}] using RSA`);
21
- const n = new i();
22
- n.setPrivateKey(t);
23
- const o = n.decrypt(r);
24
- if (!o)
25
- throw console.error("Failed to decrypt data using RSA", r), new Error(`Failed to decrypt data [${r}] using RSA`);
26
- return o;
27
- }
28
- export {
29
- p as decryptUsingRSA,
30
- a as encryptUsingRSA
31
- };
1
+ /*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
2
+ import { isNullish as e } from "./lib.js";
3
+ import t from "jsencrypt";
4
+ //#region src/utils/security.ts
5
+ var n = new Uint8Array([
6
+ 90,
7
+ 75,
8
+ 60,
9
+ 45,
10
+ 30,
11
+ 15,
12
+ 154,
13
+ 139,
14
+ 124,
15
+ 109,
16
+ 94,
17
+ 79,
18
+ 58,
19
+ 43,
20
+ 28,
21
+ 13
22
+ ]);
23
+ function r(e) {
24
+ if (!e) return new Uint8Array();
25
+ let t = new TextEncoder().encode(e), r = new Uint8Array(t.length);
26
+ for (let [e, i] of t.entries()) r[e] = i ^ n[e % n.length];
27
+ return r;
28
+ }
29
+ function i(e) {
30
+ if (!e?.length) return "";
31
+ let t = e instanceof Uint8Array ? e : new Uint8Array(e), r = new Uint8Array(t.length);
32
+ for (let [e, i] of t.entries()) r[e] = i ^ n[e % n.length];
33
+ return new TextDecoder("utf-8").decode(r);
34
+ }
35
+ function a(e) {
36
+ return [...r(e)].map((e) => e.toString(16).padStart(2, "0")).join("");
37
+ }
38
+ function o(e) {
39
+ if (!e) return "";
40
+ let t = new Uint8Array(e.length / 2);
41
+ for (let n = 0; n < e.length; n += 2) t[n / 2] = Number.parseInt(e.slice(n, n + 2), 16);
42
+ return i(t);
43
+ }
44
+ function s(e) {
45
+ let t = r(e);
46
+ if (t.length === 0) return "";
47
+ let n = String.fromCodePoint(...t);
48
+ return btoa(n);
49
+ }
50
+ function c(e) {
51
+ if (!e) return "";
52
+ let t = atob(e), n = new Uint8Array(t.length);
53
+ for (let e = 0; e < t.length; e++) n[e] = t.codePointAt(e);
54
+ return i(n);
55
+ }
56
+ function l(n, r) {
57
+ if (e(n) || !r?.trim()) throw Error("Failed to encrypt data using RSA: invalid input");
58
+ let i = new t();
59
+ i.setPublicKey(r);
60
+ let a = i.encrypt(n);
61
+ if (!a) throw console.error("Failed to encrypt data using RSA"), Error("Failed to encrypt data using RSA");
62
+ return a;
63
+ }
64
+ function u(n, r) {
65
+ if (e(n) || !r?.trim()) throw Error("Failed to decrypt data using RSA: invalid input");
66
+ let i = new t();
67
+ i.setPrivateKey(r);
68
+ let a = i.decrypt(n);
69
+ if (!a) throw console.error("Failed to decrypt data using RSA"), Error("Failed to decrypt data using RSA");
70
+ return a;
71
+ }
72
+ //#endregion
73
+ export { u as decryptUsingRSA, l as encryptUsingRSA, i as obfuscateDecode, c as obfuscateDecodeFromBase64, o as obfuscateDecodeFromHex, r as obfuscateEncode, s as obfuscateEncodeToBase64, a as obfuscateEncodeToHex };
@@ -1,8 +1,20 @@
1
- import "./lib.js";
2
- import { snake as o } from "radashi";
3
- function n(t) {
4
- return o(t).toUpperCase();
1
+ /*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
2
+ import { snakeCase as e } from "./lib.js";
3
+ //#region src/utils/string.ts
4
+ function t(t) {
5
+ return e(t).toUpperCase();
5
6
  }
6
- export {
7
- n as constantCase
8
- };
7
+ function n(e, t = !0) {
8
+ if (e === null) return t ? "" : "null";
9
+ if (e === void 0) return t ? "" : "undefined";
10
+ if (typeof e == "string") return e;
11
+ if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint") return String(e);
12
+ if (typeof e == "symbol" || typeof e == "function") return e.toString();
13
+ try {
14
+ return JSON.stringify(e);
15
+ } catch {
16
+ return String(e);
17
+ }
18
+ }
19
+ //#endregion
20
+ export { t as constantCase, n as stringify };
@@ -1,15 +1,15 @@
1
- import { isDeepEqual as i, isShallowEqual as p } from "./equal.js";
2
- import "./lib.js";
3
- import { isPlainObject as l, isArray as f } from "radashi";
4
- const u = {
5
- reference: (e, o) => e === o,
6
- shallow: p,
7
- deep: i
1
+ /*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
2
+ import { isDeepEqual as e, isShallowEqual as t } from "./equal.js";
3
+ import { isPlainObject as n } from "./lib.js";
4
+ //#region src/utils/table.ts
5
+ var r = {
6
+ reference: (e, t) => e === t,
7
+ shallow: t,
8
+ deep: e
8
9
  };
9
- function w(e, ...o) {
10
- const c = l(e) && !f(e) && "compare" in e, n = c ? e : {}, s = c ? o : [e, ...o], a = u[n.compare ?? "reference"];
11
- return (m, t) => s.some((r) => !a(m?.[r], t?.[r]));
10
+ function i(e, ...t) {
11
+ let i = n(e) && "compare" in e, a = i ? e : {}, o = i ? t : [e, ...t], s = r[a.compare ?? "reference"];
12
+ return (e, t) => o.some((n) => !s(e?.[n], t?.[n]));
12
13
  }
13
- export {
14
- w as shouldUpdateByKeys
15
- };
14
+ //#endregion
15
+ export { i as shouldUpdateByKeys };
@@ -1,8 +1,7 @@
1
- import "./lib.js";
2
- import { isFunction as o } from "radashi";
3
- function t(e) {
4
- o(queueMicrotask) ? queueMicrotask(e) : Promise.resolve().then(e);
1
+ /*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
2
+ //#region src/utils/task.ts
3
+ function e(e) {
4
+ typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e);
5
5
  }
6
- export {
7
- t as scheduleMicrotask
8
- };
6
+ //#endregion
7
+ export { e as scheduleMicrotask };
@@ -1,189 +1,167 @@
1
- import "./lib.js";
2
- import { isArray as a, isFunction as g, isNullish as I } from "radashi";
3
- function y(s, l = {}) {
4
- const {
5
- childrenKey: d = "children",
6
- includeParent: h = !1,
7
- includeLevel: o = !1,
8
- transform: c,
9
- filter: n
10
- } = l, e = [];
11
- function r(t, u, i = 0) {
12
- if (a(t))
13
- for (const f of t) {
14
- const p = { parent: u, level: i };
15
- if (g(n) && !n(f, p)) {
16
- const N = f[d];
17
- a(N) && r(N, f, i + 1);
18
- continue;
19
- }
20
- let m = f;
21
- if (g(c))
22
- m = c(f, p);
23
- else if (h || o) {
24
- const N = { data: f };
25
- h && (N.parent = u), o && (N.level = i), m = N;
26
- }
27
- e.push(m);
28
- const x = f[d];
29
- a(x) && r(x, f, i + 1);
30
- }
31
- }
32
- return r(s), e;
1
+ /*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
2
+ import { isArray as e, isFunction as t, isNullish as n } from "./lib.js";
3
+ //#region src/utils/tree.ts
4
+ function r(n, r = {}) {
5
+ let { childrenKey: i = "children", includeParent: a = !1, includeLevel: o = !1, transform: s, filter: c } = r, l = [];
6
+ function u(n, r, d = 0) {
7
+ if (e(n)) for (let f of n) {
8
+ let n = {
9
+ parent: r,
10
+ level: d
11
+ };
12
+ if (t(c) && !c(f, n)) {
13
+ let t = f[i];
14
+ e(t) && u(t, f, d + 1);
15
+ continue;
16
+ }
17
+ let p = f;
18
+ if (t(s)) p = s(f, n);
19
+ else if (a || o) {
20
+ let e = { data: f };
21
+ a && (e.parent = r), o && (e.level = d), p = e;
22
+ }
23
+ l.push(p);
24
+ let m = f[i];
25
+ e(m) && u(m, f, d + 1);
26
+ }
27
+ }
28
+ return u(n), l;
33
29
  }
34
- function T(s, l) {
35
- return g(l) ? l(s) : s[l];
30
+ function i(e, n) {
31
+ return t(n) ? n(e) : e[n];
36
32
  }
37
- function A(s, l = {}) {
38
- const {
39
- idKey: d = "id",
40
- parentIdKey: h = "parentId",
41
- childrenKey: o = "children",
42
- rootValue: c,
43
- transform: n
44
- } = l;
45
- if (!a(s) || s.length === 0)
46
- return [];
47
- const e = /* @__PURE__ */ new Map(), r = [];
48
- for (const t of s) {
49
- const u = T(t, d);
50
- e.set(u, { ...t });
51
- }
52
- for (const t of s) {
53
- const u = T(t, d), i = T(t, h), f = e.get(u);
54
- if (g(c) ? c(t) : i === c || I(i))
55
- r.push(f);
56
- else {
57
- const m = e.get(i);
58
- m ? (a(m[o]) || (m[o] = []), m[o].push(f)) : r.push(f);
59
- }
60
- }
61
- if (g(n)) {
62
- let t = function(i, f = 0) {
63
- const p = i[o], m = u(i, { children: p, level: f });
64
- return a(p) && (m[o] = p.map((x) => t(x, f + 1))), m;
65
- };
66
- const u = n;
67
- return r.map((i) => t(i));
68
- }
69
- return r;
33
+ function a(r, a = {}) {
34
+ let { idKey: o = "id", parentIdKey: s = "parentId", childrenKey: c = "children", rootValue: l, transform: u } = a;
35
+ if (!e(r) || r.length === 0) return [];
36
+ let d = /* @__PURE__ */ new Map(), f = [];
37
+ for (let e of r) {
38
+ let t = i(e, o);
39
+ d.set(t, { ...e });
40
+ }
41
+ for (let a of r) {
42
+ let r = i(a, o), u = i(a, s), p = d.get(r);
43
+ if (t(l) ? l(a) : u === l || n(u)) f.push(p);
44
+ else {
45
+ let t = d.get(u);
46
+ t ? (e(t[c]) || (t[c] = []), t[c].push(p)) : f.push(p);
47
+ }
48
+ }
49
+ if (t(u)) {
50
+ let t = u;
51
+ function n(r, i = 0) {
52
+ let a = r[c], o = t(r, {
53
+ children: a,
54
+ level: i
55
+ });
56
+ return e(a) && (o[c] = a.map((e) => n(e, i + 1))), o;
57
+ }
58
+ return f.map((e) => n(e));
59
+ }
60
+ return f;
70
61
  }
71
- function C(s, l, d = "children") {
72
- function h(o, c, n = 0) {
73
- if (a(o))
74
- for (const e of o) {
75
- if (l(e, { parent: c, level: n }))
76
- return e;
77
- const r = e[d];
78
- if (a(r)) {
79
- const t = h(r, e, n + 1);
80
- if (t)
81
- return t;
82
- }
83
- }
84
- }
85
- return h(s);
62
+ function o(t, n, r = "children") {
63
+ function i(t, a, o = 0) {
64
+ if (e(t)) for (let s of t) {
65
+ if (n(s, {
66
+ parent: a,
67
+ level: o
68
+ })) return s;
69
+ let t = s[r];
70
+ if (e(t)) {
71
+ let e = i(t, s, o + 1);
72
+ if (e) return e;
73
+ }
74
+ }
75
+ }
76
+ return i(t);
86
77
  }
87
- function F(s, l, d = {}) {
88
- const { strategy: h = "dfs", childrenKey: o = "children" } = d;
89
- if (a(s))
90
- if (h === "bfs") {
91
- const c = s.map((n, e) => ({
92
- node: n,
93
- level: 0,
94
- index: e
95
- }));
96
- for (; c.length > 0; ) {
97
- const n = c.shift();
98
- l(n.node, {
99
- parent: n.parent,
100
- level: n.level,
101
- index: n.index
102
- });
103
- const e = n.node[o];
104
- if (a(e))
105
- for (const [r, t] of e.entries())
106
- c.push({
107
- node: t,
108
- parent: n.node,
109
- level: n.level + 1,
110
- index: r
111
- });
112
- }
113
- } else {
114
- let c = function(n, e, r = 0) {
115
- if (a(n))
116
- for (const [t, u] of n.entries()) {
117
- l(u, {
118
- parent: e,
119
- level: r,
120
- index: t
121
- });
122
- const i = u[o];
123
- a(i) && c(i, u, r + 1);
124
- }
125
- };
126
- c(s);
127
- }
78
+ function s(t, n, r = {}) {
79
+ let { strategy: i = "dfs", childrenKey: a = "children" } = r;
80
+ if (e(t)) if (i === "bfs") {
81
+ let r = t.map((e, t) => ({
82
+ node: e,
83
+ level: 0,
84
+ index: t
85
+ })), i = 0;
86
+ for (; i < r.length;) {
87
+ let t = r[i++];
88
+ n(t.node, {
89
+ parent: t.parent,
90
+ level: t.level,
91
+ index: t.index
92
+ });
93
+ let o = t.node[a];
94
+ if (e(o)) for (let [e, n] of o.entries()) r.push({
95
+ node: n,
96
+ parent: t.node,
97
+ level: t.level + 1,
98
+ index: e
99
+ });
100
+ }
101
+ } else {
102
+ function r(t, i, o = 0) {
103
+ if (e(t)) for (let [s, c] of t.entries()) {
104
+ n(c, {
105
+ parent: i,
106
+ level: o,
107
+ index: s
108
+ });
109
+ let t = c[a];
110
+ e(t) && r(t, c, o + 1);
111
+ }
112
+ }
113
+ r(t);
114
+ }
128
115
  }
129
- function R(s, l, d = "children") {
130
- function h(o, c, n = 0) {
131
- return a(o) ? o.map((e, r) => {
132
- const t = l(e, {
133
- parent: c,
134
- level: n,
135
- index: r
136
- }), u = e[d];
137
- return a(u) && (t[d] = h(u, e, n + 1)), t;
138
- }) : [];
139
- }
140
- return h(s);
116
+ function c(t, n, r = "children") {
117
+ function i(t, a, o = 0) {
118
+ return e(t) ? t.map((t, s) => {
119
+ let c = n(t, {
120
+ parent: a,
121
+ level: o,
122
+ index: s
123
+ }), l = t[r];
124
+ return e(l) && (c[r] = i(l, t, o + 1)), c;
125
+ }) : [];
126
+ }
127
+ return i(t);
141
128
  }
142
- function V(s, l, d = "children") {
143
- function h(o, c, n = 0) {
144
- return a(o) ? o.reduce((e, r, t) => {
145
- if (!l(r, {
146
- parent: c,
147
- level: n,
148
- index: t
149
- }))
150
- return e;
151
- const u = r[d], i = { ...r };
152
- if (u && a(u)) {
153
- const f = h(u, r, n + 1);
154
- f.length > 0 ? i[d] = f : delete i[d];
155
- }
156
- return e.push(i), e;
157
- }, []) : [];
158
- }
159
- return h(s);
129
+ function l(t, n, r = "children") {
130
+ function i(t, a, o = 0) {
131
+ return e(t) ? t.reduce((t, s, c) => {
132
+ if (!n(s, {
133
+ parent: a,
134
+ level: o,
135
+ index: c
136
+ })) return t;
137
+ let l = s[r], u = { ...s };
138
+ if (l && e(l)) {
139
+ let e = i(l, s, o + 1);
140
+ e.length > 0 ? u[r] = e : delete u[r];
141
+ }
142
+ return t.push(u), t;
143
+ }, []) : [];
144
+ }
145
+ return i(t);
160
146
  }
161
- function b(s, l, d = "children") {
162
- function h(o, c, n = 0) {
163
- if (!a(o))
164
- return [];
165
- const e = [];
166
- for (const [r, t] of o.entries()) {
167
- const u = l(t, {
168
- parent: c,
169
- level: n,
170
- index: r
171
- }), i = t[d], f = a(i) ? h(i, t, n + 1) : [];
172
- if (u || f.length > 0) {
173
- const p = { ...t };
174
- f.length > 0 ? p[d] = f : delete p[d], e.push(p);
175
- }
176
- }
177
- return e;
178
- }
179
- return h(s);
147
+ function u(t, n, r = "children") {
148
+ function i(t, a, o = 0) {
149
+ if (!e(t)) return [];
150
+ let s = [];
151
+ for (let [c, l] of t.entries()) {
152
+ let t = n(l, {
153
+ parent: a,
154
+ level: o,
155
+ index: c
156
+ }), u = l[r], d = e(u) ? i(u, l, o + 1) : [];
157
+ if (t || d.length > 0) {
158
+ let e = { ...l };
159
+ d.length > 0 ? e[r] = d : delete e[r], s.push(e);
160
+ }
161
+ }
162
+ return s;
163
+ }
164
+ return i(t);
180
165
  }
181
- export {
182
- A as buildTree,
183
- V as filterTree,
184
- b as filterTreeWithAncestors,
185
- C as findNodeInTree,
186
- y as flattenTree,
187
- R as mapTree,
188
- F as traverseTree
189
- };
166
+ //#endregion
167
+ export { a as buildTree, l as filterTree, u as filterTreeWithAncestors, o as findNodeInTree, r as flattenTree, c as mapTree, s as traverseTree };
@@ -1,7 +1,7 @@
1
- import { z as o } from "zod";
2
- import { z as t } from "zod";
3
- import { zhCN as r } from "zod/locales";
4
- o.config(r());
5
- export {
6
- t as z
7
- };
1
+ /*! @vef-framework/shared v2.1.0 made by Venus | 2026-03-27T07:12:59.574Z */
2
+ import { z as e, z as t } from "zod";
3
+ import { zhCN as n } from "zod/locales";
4
+ //#region src/utils/zod.ts
5
+ e.config(n());
6
+ //#endregion
7
+ export { t as z };